Invalid Read access

Hi All,

I would like to know how the valgrind find the runtime allocation related issues?such as the below

invalid read of size 4.
Invalid write of size 4.

Even the size of memory is known at runtime,valgrind reports this

I am asking this since i got an issue which is trying to access unknown memory and that size is declared at compile time.
memcpy() statement throws

Invalid read error

.

Thank you