This is the mail archive of the
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: <email@example.com>
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.
2013-01-29 Xi Wang <firstname.lastname@example.org>
* readelf.c (process_version_sections): Fix overflow checks to
avoid undefined behaviour.