stb_truetype: fix bug in handling of stbtt_hheap that could cause severe badness

This commit is contained in:
Sean Barrett 2018-01-29 07:44:54 -08:00
parent db4d92891c
commit 87352fdcb5

View File

@ -43,7 +43,7 @@
// Hou Qiming Derek Vinyard // Hou Qiming Derek Vinyard
// Rob Loach Cort Stratton // Rob Loach Cort Stratton
// Kenney Phillis Jr. github:oyvindjam // Kenney Phillis Jr. github:oyvindjam
// github:vassvik // Brian Costabile github:vassvik
// //
// VERSION HISTORY // VERSION HISTORY
// //
@ -2412,7 +2412,7 @@ static void *stbtt__hheap_alloc(stbtt__hheap *hh, size_t size, void *userdata)
hh->num_remaining_in_head_chunk = count; hh->num_remaining_in_head_chunk = count;
} }
--hh->num_remaining_in_head_chunk; --hh->num_remaining_in_head_chunk;
return (char *) (hh->head) + size * hh->num_remaining_in_head_chunk; return (char *) (hh->head) + sizeof(stbtt__hheap_chunk) + size * hh->num_remaining_in_head_chunk;
} }
} }