]> granicus.if.org Git - clang/commit
Fix a nasty bug where inside StringLiteralParser:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 17 May 2011 22:09:56 +0000 (22:09 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 17 May 2011 22:09:56 +0000 (22:09 +0000)
commit403de3f932b5d1d3e4e58f69960000911d04dd2a
tree9a6c4fa89a831a217520de692bf9be4a4973911a
parent5adc0515aaacb6c4d4f0c9626d86c1e5c177467c
Fix a nasty bug where inside StringLiteralParser:

1. We would assume that the length of the string literal token was at least 2
2. We would allocate a buffer with size length-2

And when the stars aligned (one of which would be an invalid source location due to stale PCH)
The length would be 0 and we would try to allocate a 4GB buffer.

Add checks for this corner case and a bunch of asserts.
(We really really should have had an assert for 1.).

Note that there's no test case since I couldn't get one (it was major PITA to reproduce),
maybe later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131492 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Lex/LiteralSupport.h
lib/Lex/LiteralSupport.cpp