Fix incorrect memmove size in LDB breakpoint deletion (#15115)

# Description
There is an array corruption bug in LDB caused by an incorrect size
argument being passed to `memmove()` inside the `ldbDelBreakpoint()`
function.

When deleting a breakpoint, `memmove()` is used to shift the remaining
breakpoints in the ldb.bp integer array forward. However, the size
parameter passes the number of elements rather than the number of bytes.
Because ldb.bp is an array of type `int`, this results in an under-copy.
This commit is contained in:
Leenear 2026-05-10 09:01:08 +04:00 committed by GitHub
parent 7bdab45ff1
commit bf432c98fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1027,7 +1027,7 @@ int ldbDelBreakpoint(int line) {
for (j = 0; j < ldb.bpcount; j++) {
if (ldb.bp[j] == line) {
ldb.bpcount--;
memmove(ldb.bp+j,ldb.bp+j+1,ldb.bpcount-j);
memmove(ldb.bp+j,ldb.bp+j+1,(ldb.bpcount-j) * sizeof(int));
return 1;
}
}