Recover an index from a memory report

On a system where sizeof(int) is 4 bytes, a points to the start of a successful 44-byte allocation. Memcheck reports an invalid read of size 4 at an address 8 bytes after that block's exclusive end boundary. Assume the read is exactly a[i], using zero-based indexing and an unchanged base pointer. What is i? Answer as an integer to zero decimal places; the index has no units.


A forty-four-byte allocation ends eight bytes before the reported read address.


Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More GDB & Valgrind Questions: