This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] readelf.c: fix multiple pointer overflows
- From: nick clifton <nickc at redhat dot com>
- To: Xi Wang <xi dot wang at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 29 Jan 2013 08:52:21 +0000
- Subject: Re: [PATCH] readelf.c: fix multiple pointer overflows
- References: <1359410569-18444-1-git-send-email-xi.wang@gmail.com>
Hi Xi,
Many compilers such as gcc and clang optimize away overflow checks
`p + n < p', because in C pointer overflow is undefined behavior.
Use a safe form `n > end - p' instead.
Thanks for reporting this problem. I have checked your patch in along
with the following changelog entry.
Cheers
Nick
binutils/ChangeLog
2013-01-29 Xi Wang <xi.wang@gmail.com>
* readelf.c (process_version_sections): Fix overflow checks to
avoid undefined behaviour.