Skip to content

Commit 6432af3

Browse files
committed
Merge branch 'master' of https://github.com/pre10der89/ChakraCore into chakra_nuget
2 parents bfec5a6 + 71a87b0 commit 6432af3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/Common/Codex/Utf8Codex.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,9 @@ namespace utf8
397397
LSlowPath:
398398
while (cch-- > 0)
399399
{
400-
*buffer++ = Decode(ptr, ptr + 4, localOptions); // WARNING: Assume cch correct, suppress end-of-buffer checking
400+
LPCUTF8 end = ptr + cch + 1; // WARNING: Assume cch correct, suppress end-of-buffer checking
401+
402+
*buffer++ = Decode(ptr, end, localOptions);
401403
if (ShouldFastPath(ptr, buffer)) goto LFastPath;
402404
}
403405
}
@@ -466,7 +468,9 @@ namespace utf8
466468
DecodeOptions localOptions = options;
467469
while (cch-- > 0)
468470
{
469-
if (*pch++ != utf8::Decode(bch, bch + 4, localOptions)) // WARNING: Assume cch correct, suppress end-of-buffer checking
471+
LPCUTF8 end = bch + cch + 1; // WARNING: Assume cch correct, suppress end-of-buffer checking
472+
473+
if (*pch++ != utf8::Decode(bch, end, localOptions))
470474
return false;
471475
}
472476
return true;

lib/Parser/HashFunc.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ ULONG CaseSensitiveComputeHashCch(LPCUTF8 prgch, int32 cch)
3131
ULONG luHash = 0;
3232

3333
while (cch-- > 0)
34-
luHash = 17 * luHash + utf8::Decode(prgch, prgch + 4, options); // WARNING: Assume cch correct, suppress end-of-buffer checking
34+
{
35+
LPCUTF8 end = prgch + cch + 1; // WARNING: Assume cch correct, suppress end-of-buffer checking
36+
37+
luHash = 17 * luHash + utf8::Decode(prgch, end, options);
38+
}
3539
return luHash;
3640
}
3741

0 commit comments

Comments
 (0)