July 2017
Intermediate to advanced
244 pages
6h 33m
English
For memory allocation functions, Memcheck validates whether the arguments passed to them actually make sense. One example of this would be the passing of a negative size, or if it would far exceed a reasonable allocation size: for example, an allocation request for a petabyte of memory. Most likely, these values would be the result of a faulty calculation earlier in the code.
Memcheck would report this error like in this example from the Memcheck manual:
==32233== Argument 'size' of function malloc has a fishy (possibly negative) value: -3==32233== at 0x4C2CFA7: malloc (vg_replace_malloc.c:298)==32233== by 0x400555: foo (fishy.c:15)==32233== by 0x400583: main (fishy.c:23)
Here it was attempted to pass the value of ...
Read now
Unlock full access