On Fri, 2014-01-17 at 03:32 -0800, Lei Zhang wrote: > We have a large binary on a 32-bit host where the following command failed: > > eu-strip -o foo.stripped -f foo.debug foo > > eu-strip: while computing checksum for debug information: Invalid argument > > Here, foo.debug is over 2 GB. The crc code called pread() with a > negative offset because crc32_file.c does not have LFS, off_t is only > 32-bit, and the offset variable overflowed.
Yes, I think you are correct. We use AC_SYS_LARGEFILE which sets up _FILE_OFFSET_BITS in config.h. The reason it works in the other case (libdwfl) is that the file is included as a whole in libdwfl/libdwfl_crc32_file.c which does have an include config.h at the top before the inclusion. strip just includes system.h and links against libeu.a instead. Applied, with a ChangeLog entry. BTW. It isn't necessary for trivially correct stuff like this, but please add a Signed-off-by: line next time. See the CONTRIBUTING file. Thanks, Mark
>From dca862bff918446f7e6fffc7f62d75663c73028f Mon Sep 17 00:00:00 2001 From: Lei Zhang <[email protected]> Date: Fri, 17 Jan 2014 03:20:45 -0800 Subject: [PATCH] lib: Add missing config.h #include to crc32_file.c. Without config.h, there is no possibility of large file support. Signed-off-by: Mark Wielaard <[email protected]> --- lib/ChangeLog | 4 ++++ lib/crc32_file.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 9b8899e..4415213 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2014-01-17 Lei Zhang <[email protected]> + + * crc32_file.c: Include config.h. + 2013-12-12 Josh Stone <[email protected]> * dynamicsizehash.c (lookup): Add a shortcut around division. diff --git a/lib/crc32_file.c b/lib/crc32_file.c index 9a168f6..c0b18e9 100644 --- a/lib/crc32_file.c +++ b/lib/crc32_file.c @@ -26,6 +26,10 @@ the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include "system.h" #include <errno.h> #include <unistd.h> -- 1.7.1
