Berry fixed a rare condition when a GC causes a memory corruption (#18614)

This commit is contained in:
s-hadinger 2023-05-08 21:59:32 +02:00 committed by GitHub
parent c5e6115597
commit 4cd1136f4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- Partition_Manager.tapp fixed
- Berry fixed a rare condition when a GC causes a memory corruption
### Removed

View File

@ -195,6 +195,9 @@ static bstring* newshortstr(bvm *vm, const char *str, size_t len)
}
s = createstrobj(vm, len, 0);
if (s) {
/* recompute size and list that may have changed due to a GC */
size = vm->strtab.size;
list = vm->strtab.table + (hash & (size - 1));
memcpy(cast(char *, sstr(s)), str, len);
s->extra = 0;
s->next = cast(void*, *list);