Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 48b0ca2

Browse files
hashseedjoaocgreis
authored andcommitted
V8: do not use wide reads in CopyCharsUnsigned
Fixes segfault in 32bit SmartOS when built with GCC 4.9. This is the first of two backports from upstream v8: 1. v8/v8@90dc5c9 2. v8/v8@7cb82a7 Original commit message: Do not use wide reads in CopyCharsUnsigned. R=jkummerow@chromium.org BUG=chromium:412967 LOG=Y Review URL: https://codereview.chromium.org/566583002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23876 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 V8 issue: https://code.google.com/p/chromium/issues/detail?id=412967 Fixes #25281 Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #25556
1 parent 88a27a9 commit 48b0ca2

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

deps/v8/src/utils.h

+4-14
Original file line numberDiff line numberDiff line change
@@ -1351,20 +1351,10 @@ template <typename sourcechar, typename sinkchar>
13511351
void CopyCharsUnsigned(sinkchar* dest, const sourcechar* src, int chars) {
13521352
sinkchar* limit = dest + chars;
13531353
#ifdef V8_HOST_CAN_READ_UNALIGNED
1354-
if (sizeof(*dest) == sizeof(*src)) {
1355-
if (chars >= static_cast<int>(kMinComplexMemCopy / sizeof(*dest))) {
1356-
MemCopy(dest, src, chars * sizeof(*dest));
1357-
return;
1358-
}
1359-
// Number of characters in a uintptr_t.
1360-
static const int kStepSize = sizeof(uintptr_t) / sizeof(*dest); // NOLINT
1361-
DCHECK(dest + kStepSize > dest); // Check for overflow.
1362-
while (dest + kStepSize <= limit) {
1363-
*reinterpret_cast<uintptr_t*>(dest) =
1364-
*reinterpret_cast<const uintptr_t*>(src);
1365-
dest += kStepSize;
1366-
src += kStepSize;
1367-
}
1354+
if ((sizeof(*dest) == sizeof(*src)) &&
1355+
(chars >= static_cast<int>(kMinComplexMemCopy / sizeof(*dest)))) {
1356+
MemCopy(dest, src, chars * sizeof(*dest));
1357+
return;
13681358
}
13691359
#endif
13701360
while (dest < limit) {

0 commit comments

Comments
 (0)