Bug 853906 (CVE-2002-2439) - CVE-2002-2439 gcc: Integer overflow can occur during the computation of the memory region size for new[] operator
Summary: CVE-2002-2439 gcc: Integer overflow can occur during the computation of the m...
Keywords:
Status: CLOSED WONTFIX
Alias: CVE-2002-2439
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 853918 853919
Blocks: 853928
TreeView+ depends on / blocked
 
Reported: 2012-09-03 09:54 UTC by Jan Lieskovsky
Modified: 2019-09-29 12:55 UTC (History)
5 users (show)

Fixed In Version: gcc 4.8.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-10-20 18:26:31 UTC
Embargoed:


Attachments (Terms of Use)

Description Jan Lieskovsky 2012-09-03 09:54:49 UTC
It was reported that C++ new[] operator was previously missing integer overflow / wrap around checks for its arguments. If an application compiled with gcc accepted untrusted input for memory allocation and was missing application-level checks for integer overflows of arguments, provided to the new[] operator, an attacker could use this flaw to cause the memory region, allocated in the end for the new[] operator statement, it to be smaller than truly required, possibly leading to heap-based buffer overflows.

Upstream bug report:
[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19351

Upstream patches:
[2] http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01689.html
[3] http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01416.html

References:
[4] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35790
[5] http://cert.uni-stuttgart.de/ticker/advisories/calloc.html

Comment 1 Jan Lieskovsky 2012-09-03 10:16:07 UTC
This issue affects the versions of the gcc package, as shipped with Fedora release of 16 and 17. Please schedule an update.

--

This issue affects the versions of the compat-gcc-34 packages, as shipped with Fedora release of 16 and 17. Please schedule an update.

Comment 2 Jan Lieskovsky 2012-09-03 10:17:34 UTC
Created compat-gcc-34 tracking bugs for this issue

Affects: fedora-all [bug 853919]

Comment 3 Jan Lieskovsky 2012-09-03 10:17:37 UTC
Created gcc tracking bugs for this issue

Affects: fedora-all [bug 853918]

Comment 4 Jan Lieskovsky 2012-09-03 10:19:02 UTC
Reproducer (from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19351#c0):
-----------------------------------------------------------------------

#include <testsuite_hooks.h>

struct foo
{
  char data[16];
  void* operator new[] (size_t size)
  {
    VERIFY(size != sizeof(foo));
    VERIFY (false);
    return malloc(size);
  }
};

int
main()
{
  size_t size = size_t (-1) / sizeof(foo) + 2;
  try
    {
      foo* f = new foo[size];
      VERIFY (f == 0);
      VERIFY (false);
    }
  catch(std::bad_alloc&)
    {
      return 0;
    }
}

Comment 7 Josh Bressers 2014-06-13 17:31:55 UTC
I'm going to close this bug. It's fixed upstream, but not something we can backport without creating issues.


Note You need to log in before you can comment on or make changes to this bug.