ref: f631542dae1aaf9101135ed660cd3ff1d08ed93c
parent: c213c8a9bb2fcb4e5befc7aaa605125d3c5a2bf4
author: Alexei Podtelezhnikov <[email protected]>
date: Tue Apr 27 07:39:58 EDT 2021
[lzw] Preserve decompression stack when relocating to heap. * src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Copy stack when relocating to heap.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2021-04-27 Alexei Podtelezhnikov <[email protected]>
+ [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 <[email protected]>
+
* src/cid/cidgload.c (cid_load_glyph): Restore the glyph_length check.
2021-04-27 Werner Lemberg <[email protected]>
--- a/src/lzw/ftzopen.c
+++ b/src/lzw/ftzopen.c
@@ -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,8 +143,12 @@
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;
}