[LLVMbugs] [Bug 9256] New: clang: support for kernel code model: pointer arithmetic that overflows is not impossible!
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Feb 19 02:50:11 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9256
Summary: clang: support for kernel code model: pointer
arithmetic that overflows is not impossible!
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: edwintorok at gmail.com
CC: llvmbugs at cs.uiuc.edu
Depends on: 4068
Just a reminder that kernel/s lib/vsprintf.c still needs this patch, because
pointer arithmetic overflows, and clang's optimizer assume pointer arithmetic
never overflows.
In the kernel it is very much possible to overflow, and we must calculate the
correct value, because it is then used in an 'if' for bounds checking.
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index c150d3d..8791762 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1294,7 +1294,10 @@ int vsnprintf(char *buf, size_t size, const char *fmt,
va_list args)
return 0;
str = buf;
- end = buf + size;
+ /* LLVM local */
+ end = RELOC_HIDE(buf, size);
+ /* LLVM local end */
+
/* Make sure end is always >= buf */
if (end < buf) {
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list