]> granicus.if.org Git - libass/commitdiff
shaper: fix reallocation
authorGrigori Goronzy <greg@chown.ath.cx>
Tue, 4 Oct 2016 00:35:26 +0000 (02:35 +0200)
committerGrigori Goronzy <greg@chown.ath.cx>
Tue, 4 Oct 2016 17:45:07 +0000 (19:45 +0200)
Update the variable that tracks the allocated size. This potentially
improves performance and avoid some side effects, which lead to
undefined behavior in some cases.

Fixes fuzzer test case id:000051,sig:11,sync:fuzzer3,src:004221.

libass/ass_shaper.c

index 2707b2362e44d7beae2a196437f983bb4b4c7abe..5f24c5a955fdec1abb5eaeafa7b313f4845d7b77 100644 (file)
@@ -100,6 +100,7 @@ static bool check_allocations(ASS_Shaper *shaper, size_t new_size)
             !ASS_REALLOC_ARRAY(shaper->emblevels, new_size) ||
             !ASS_REALLOC_ARRAY(shaper->cmap, new_size))
             return false;
+        shaper->n_glyphs = new_size;
     }
     return true;
 }