Merge branch 'issue-799' of https://github.com/pwaller/stb into work2

This commit is contained in:
Sean Barrett 2020-02-02 10:04:39 -08:00
commit aad77ec74e

View File

@ -30,7 +30,7 @@
// Tom Beaumont Ingo Leitgeb Nicolas Guillemot // Tom Beaumont Ingo Leitgeb Nicolas Guillemot
// Phillip Bennefall Rohit Thiago Goulart // Phillip Bennefall Rohit Thiago Goulart
// manxorist@github saga musix github:infatum // manxorist@github saga musix github:infatum
// Timur Gagiev Maxwell Koo // Timur Gagiev Maxwell Koo Peter Waller
// //
// Partial history: // Partial history:
// 1.17 - 2019-07-08 - fix CVE-2019-13217..CVE-2019-13223 (by ForAllSecure) // 1.17 - 2019-07-08 - fix CVE-2019-13217..CVE-2019-13223 (by ForAllSecure)
@ -912,7 +912,7 @@ static void *make_block_array(void *mem, int count, int size)
static void *setup_malloc(vorb *f, int sz) static void *setup_malloc(vorb *f, int sz)
{ {
sz = (sz+3) & ~3; sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs.
f->setup_memory_required += sz; f->setup_memory_required += sz;
if (f->alloc.alloc_buffer) { if (f->alloc.alloc_buffer) {
void *p = (char *) f->alloc.alloc_buffer + f->setup_offset; void *p = (char *) f->alloc.alloc_buffer + f->setup_offset;
@ -931,7 +931,7 @@ static void setup_free(vorb *f, void *p)
static void *setup_temp_malloc(vorb *f, int sz) static void *setup_temp_malloc(vorb *f, int sz)
{ {
sz = (sz+3) & ~3; sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs.
if (f->alloc.alloc_buffer) { if (f->alloc.alloc_buffer) {
if (f->temp_offset - sz < f->setup_offset) return NULL; if (f->temp_offset - sz < f->setup_offset) return NULL;
f->temp_offset -= sz; f->temp_offset -= sz;