Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad520ec

Browse filesBrowse files
committed
Use memmove() not memcpy() to slide some pointers down.
The previous coding here was formally undefined, though it seems to accidentally work on most platforms in the buildfarm. Caught by some OpenBSD platforms in which libc contains an assertion check for overlapping areas passed to memcpy(). Thomas Munro
1 parent 4c804fb commit ad520ec
Copy full SHA for ad520ec

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed

‎src/test/isolation/isolationtester.c

Copy file name to clipboardExpand all lines: src/test/isolation/isolationtester.c
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,8 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
554554

555555
/* Remove that step from the waiting[] array. */
556556
if (w + 1 < nwaiting)
557-
memcpy(&waiting[w], &waiting[w + 1],
558-
(nwaiting - (w + 1)) * sizeof(Step *));
557+
memmove(&waiting[w], &waiting[w + 1],
558+
(nwaiting - (w + 1)) * sizeof(Step *));
559559
nwaiting--;
560560

561561
break;
@@ -582,8 +582,8 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
582582
/* This one finished, too! */
583583
errorstep[nerrorstep++] = waiting[w];
584584
if (w + 1 < nwaiting)
585-
memcpy(&waiting[w], &waiting[w + 1],
586-
(nwaiting - (w + 1)) * sizeof(Step *));
585+
memmove(&waiting[w], &waiting[w + 1],
586+
(nwaiting - (w + 1)) * sizeof(Step *));
587587
nwaiting--;
588588
}
589589
}
@@ -614,8 +614,8 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
614614
{
615615
errorstep[nerrorstep++] = waiting[w];
616616
if (w + 1 < nwaiting)
617-
memcpy(&waiting[w], &waiting[w + 1],
618-
(nwaiting - (w + 1)) * sizeof(Step *));
617+
memmove(&waiting[w], &waiting[w + 1],
618+
(nwaiting - (w + 1)) * sizeof(Step *));
619619
nwaiting--;
620620
}
621621
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.