This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Check for truncated registers in process_g_packet


*** TEST RESULTS FOR COMMIT 9dc193c3be85aafa60ceff57d3b0430af607b4ce ***

Author: Lionel Flandrin <lionel@svkt.org>
Branch: master
Commit: 9dc193c3be85aafa60ceff57d3b0430af607b4ce

Check for truncated registers in process_g_packet

While investigating an unrelated issue in remote.c I noticed that the
bound checking for 'g' packets was bogus:

The previous code would only check that the first byte of the register
was within bounds before passing the buffer to regcache_raw_supply.
If it turned out that the register in the 'g' packet was incomplete
then regcache_raw_supply would proceed to memcpy out-of-bounds.

Since the buffer is allocated with alloca it's relatively unlikely to
crash (you just end up dumping gdb's stack into the cache) but it's
still a bit messy.

I changed this logic to check for truncated registers and raise an
error if one is encountered.  Hopefully it should make debugging
remote stubs a bit easier.

gdb/ChangeLog:
2016-11-08  Lionel Flandrin  <lionel@svkt.org>

	* remote.c (process_g_packet): Detect truncated registers in 'g'
	packets and raise an error.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]