diff options
author | Don Breazeal <donb@codesourcery.com> | 2016-02-10 15:41:55 -0800 |
---|---|---|
committer | Don Breazeal <donb@codesourcery.com> | 2016-02-10 15:42:15 -0800 |
commit | 718b36fead887693158396b948d7f409b987c053 (patch) | |
tree | 12a0530f95c0af1dcec1370e41177313240d10d7 | |
parent | 9939a5ae6e80626c29fe602d366e9eece9652d06 (diff) | |
download | gdb-718b36fead887693158396b948d7f409b987c053.zip gdb-718b36fead887693158396b948d7f409b987c053.tar.gz gdb-718b36fead887693158396b948d7f409b987c053.tar.bz2 |
Fix '-data-read-memory-bytes' typo/assertiongdb-7.10-branch
Backported to the 7.10 branch per this thread:
https://www.sourceware.org/ml/gdb-patches/2016-02/msg00134.html
This patch fixes a typo in target.c:read_memory_robust, where
it calls read_whatever_is_readable with the function arguments
in the wrong order. Depending on the address being read, it
can cause an xmalloc with a huge size, resulting in an assertion
failure, or just read something other than what was requested.
The problem only arises when GDB is handling an MI
"-data-read-memory-bytes" request and the initial target_read returns
an error status. Note that read_memory_robust is only called from
the MI code.
gdb/ChangeLog:
* gdb/target.c (read_memory_robust): Call
read_whatever_is_readable with arguments in the correct order.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/target.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 24589c8..2206259 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-11-19 Don Breazeal <donb@codesourcery.com> + + * target.c (read_memory_robust): Call read_whatever_is_readable + with arguments in the correct order. + 2015-12-05 Joel Brobecker <brobecker@adacore.com> * version.in: Set GDB version number to 7.10.1.DATE-cvs. diff --git a/gdb/target.c b/gdb/target.c index 4dd991a..4731491 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1822,8 +1822,9 @@ read_memory_robust (struct target_ops *ops, /* Got an error reading full chunk. See if maybe we can read some subrange. */ xfree (buffer); - read_whatever_is_readable (ops, offset + xfered_total, unit_size, - offset + xfered_total + to_read, &result); + read_whatever_is_readable (ops, offset + xfered_total, + offset + xfered_total + to_read, + unit_size, &result); xfered_total += to_read; } else |