Some C compilers optimize away pointer arithmetic overflow tests that depend on undefined behavior without providing a diagnostic (a warning). Applications containing these tests may be vulnerable to buffer overflows if compiled with these compilers.
In the C language, given the following types:
An application that performs wrapping checks based on an expression such as the one described above may be vulnerable to buffer overflow if compiled with affected compiler implementations. The nature of the resulting vulnerability would be specific to the application and depends on how the affected code is used.
GNU Compiler Collection
Sun Microsystems, Inc.
Silicon Graphics, Inc.
Wind River Systems, Inc.
Felix von Leitner originally published information about this behavior in the gcc compiler. Russ Cox later noticed this behavior as well and provided additional information and assistance.
This document was written by Chad R Dougherty and Robert C Seacord.
|Date First Published:||2008-04-04|
|Date Last Updated:||2008-10-08 14:13 UTC|