forked from OSchip/llvm-project
parent
0d670b5b92
commit
ca42a51dce
|
@ -2515,6 +2515,9 @@ IdentifierInfo *PCHReader::DecodeIdentifierInfo(unsigned ID) {
|
||||||
// All of the strings in the PCH file are preceded by a 16-bit
|
// All of the strings in the PCH file are preceded by a 16-bit
|
||||||
// length. Extract that 16-bit length to avoid having to execute
|
// length. Extract that 16-bit length to avoid having to execute
|
||||||
// strlen().
|
// strlen().
|
||||||
|
// NOTE: 'StrLenPtr' is an 'unsigned char*' so that we load bytes as
|
||||||
|
// unsigned integers. This is important to avoid integer overflow when
|
||||||
|
// we cast them to 'unsigned'.
|
||||||
const unsigned char *StrLenPtr = (const unsigned char*) Str - 2;
|
const unsigned char *StrLenPtr = (const unsigned char*) Str - 2;
|
||||||
unsigned StrLen = (((unsigned) StrLenPtr[0])
|
unsigned StrLen = (((unsigned) StrLenPtr[0])
|
||||||
| (((unsigned) StrLenPtr[1]) << 8)) - 1;
|
| (((unsigned) StrLenPtr[1]) << 8)) - 1;
|
||||||
|
|
Loading…
Reference in New Issue