Skip to content

Commit 3d9cf4b

Browse files
Milad Farazmandtargos
Milad Farazmand
authored andcommitted
deps: V8: cherry-pick e1eac1b16c96
Original commit message: Fix compilation error with devtoolset-8 We are compiling V8 using devtoolset-8 and it is generating a new compilation error related to String Truncation: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated copying between 1 and 15 bytes from a string of length 15 [-Werror=stringop-truncation] strncpy(buffer, unicode_utf8, i); Which basically means the null terminating character was not added to the end of the buffer: https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/ This CL will changes 2 uses of "strncpy" to "memcpy" as strings are being copied partially and `\n` being added at a later stage. Change-Id: I3656afb00463d70ddb8700a487a1978b793e1d09 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2155038 Reviewed-by: Andreas Haas <[email protected]> Reviewed-by: Toon Verwaest <[email protected]> Commit-Queue: Milad Farazmand <[email protected]> Cr-Commit-Position: refs/heads/master@{#67277} Refs: v8/v8@e1eac1b Backport-PR-URL: #33376 PR-URL: #32831 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent cdeade3 commit 3d9cf4b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.9',
39+
'v8_embedder_string': '-node.10',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/test/cctest/parsing/test-scanner-streams.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ TEST(Utf8AdvanceUntilOverChunkBoundaries) {
331331
for (size_t i = 1; i < len; i++) {
332332
// Copy source string into buffer, splitting it at i.
333333
// Then add three chunks, 0..i-1, i..strlen-1, empty.
334-
strncpy(buffer, unicode_utf8, i);
335-
strncpy(buffer + i + 1, unicode_utf8 + i, len - i);
334+
memcpy(buffer, unicode_utf8, i);
335+
memcpy(buffer + i + 1, unicode_utf8 + i, len - i);
336336
buffer[i] = '\0';
337337
buffer[len + 1] = '\n';
338338
buffer[len + 2] = '\0';
@@ -360,8 +360,8 @@ TEST(Utf8ChunkBoundaries) {
360360
for (size_t i = 1; i < len; i++) {
361361
// Copy source string into buffer, splitting it at i.
362362
// Then add three chunks, 0..i-1, i..strlen-1, empty.
363-
strncpy(buffer, unicode_utf8, i);
364-
strncpy(buffer + i + 1, unicode_utf8 + i, len - i);
363+
memcpy(buffer, unicode_utf8, i);
364+
memcpy(buffer + i + 1, unicode_utf8 + i, len - i);
365365
buffer[i] = '\0';
366366
buffer[len + 1] = '\0';
367367
buffer[len + 2] = '\0';

0 commit comments

Comments
 (0)