[lzw] Preserve decompression stack when relocating to heap.

* src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Copy stack when
relocating to heap.
This commit is contained in:
Alexei Podtelezhnikov 2021-04-27 11:39:58 -04:00
parent c213c8a9bb
commit f631542dae
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2021-04-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[lzw] Preserve decompression stack when relocating to heap.
* src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Copy stack when
relocating to heap.
2021-04-27 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidgload.c (cid_load_glyph): Restore the glyph_length check.

View File

@ -127,6 +127,7 @@
new_size = new_size + ( new_size >> 1 ) + 4;
/* if relocating to heap */
if ( state->stack == state->stack_0 )
{
state->stack = NULL;
@ -142,9 +143,13 @@
return -1;
}
if ( FT_RENEW_ARRAY( state->stack, old_size, new_size ) )
if ( FT_QRENEW_ARRAY( state->stack, old_size, new_size ) )
return -1;
/* if relocating to heap */
if ( old_size == 0 )
FT_MEM_COPY( state->stack, state->stack_0, FT_LZW_DEFAULT_STACK_SIZE );
state->stack_size = new_size;
}
return 0;