[Bug 204230] [patch] bsdiff(1) - check file size against SIZE_MAX

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Nov 2 21:52:26 UTC 2015


            Bug ID: 204230
           Summary: [patch] bsdiff(1) - check file size against SIZE_MAX
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: tobias at stoeckmann.org
          Keywords: patch

Created attachment 162714
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=162714&action=edit
proposed fix

When bsdiff opens binary files, it does not properly check if the file size
(off_t 64 bit) is larger than theoretical maximum memory size (size_t 64 or
just 32 bit).

Files that large won't work with the current code, because they clearly run out
of memory. But due to +1 calculation, the integer value can overflow and binary
data is written into unallocated memory (0 bytes), crashing the application.

The fix is simple: If file is too large, handle it as an I/O error.

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list