Skip to content

Commit 8273a03

Browse files
committed
COMMON: fix memory overlap error
1 parent aab4d7a commit 8273a03

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

samples/distro-examples/tests/array.bas

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,16 @@ if (sim(0) <> 50) then
6969
throw "dim sim not tasty"
7070
fi
7171

72+
rem ==6866== Source and destination overlap in memcpy(0xfc3f090, 0xfc3f096, 13)
73+
rem ==6866== at 0x4C32513: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
74+
rem ==6866== by 0x48D4A3: memcpy (string3.h:53)
75+
rem ==6866== by 0x48D4A3: comp_text_line_let (scan.c:1874)
76+
77+
dim dots(1)
78+
dots(0).y = 100
79+
dots(0).dy = 1
80+
dots(0).y += dots(0).dy
81+
if (dots(0).y != 101) then
82+
throw "not 101 !!!"
83+
endif
7284

src/common/scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,7 @@ void comp_text_line_let(long idx, int ladd, int linc, int ldec, int leqop) {
18701870

18711871
// store plain operator in comp_bc_parm
18721872
int len = strlen(p);
1873-
memcpy(comp_bc_parm, p, len);
1873+
memmove(comp_bc_parm, p, len);
18741874
comp_bc_parm[len] = '\0';
18751875

18761876
comp_get_unary(comp_bc_parm, &ladd, &linc, &ldec, &leqop);

0 commit comments

Comments
 (0)