Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main: fix reading outside malloced area. #3376

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/numarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
extern void prefix##ArrayDeleteItem (prefix##Array* const current, unsigned int indx) \
{ \
memmove (current->array + indx, current->array + indx + 1, \
(current->count - indx) * sizeof (*current->array)); \
(current->count - indx - 1) * sizeof (*current->array)); \
--current->count; \
} \
static int prefix##GreaterThan(const void *a, const void *b) \
Expand Down
4 changes: 2 additions & 2 deletions main/ptrarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ extern void ptrArrayDeleteItem (ptrArray* const current, unsigned int indx)
current->deleteFunc (ptr);

memmove (current->array + indx, current->array + indx + 1,
(current->count - indx) * sizeof (*current->array));
(current->count - indx - 1) * sizeof (*current->array));
--current->count;
}

Expand All @@ -208,7 +208,7 @@ extern void*ptrArrayRemoveItem (ptrArray* const current, unsigned int indx)
void *ptr = current->array[indx];

memmove (current->array + indx, current->array + indx + 1,
(current->count - indx) * sizeof (*current->array));
(current->count - indx - 1) * sizeof (*current->array));
--current->count;

return ptr;
Expand Down