libass: fix compilation with older versions of libass
[vlc.git] / contrib / src / faad2 / faad2-fix-cpe-reconstruction.patch
blob9a345863d384a2270a30a0a17e1a0ff2a599174a
1 hDecoder->element_alloced denotes whether or not we have allocated memory for
2 usage in terms of the specified channel element. Given that it previously only
3 had two states (1 meaning allocated, and 0 meaning not allocated), it would not
4 allocate enough memory for parsing a CPE it if is preceeded by a SCE (and
5 therefor crash).
7 These changes fixes the issue by making sure that we allocate additional memory
8 if so is necessary, and the set of values for hDecoder->element_alloced[n] is
9 now:
11 0 = nothing allocated
12 1 = allocated enough for SCE
13 2 = allocated enough for CPE
15 All branches that depend on hDecoder->element_alloced[n] prior to this patch
16 only checks if the value is, or is not, zero. The added state, 2, is therefor
17 correctly handled automatically.
19 --- faad2/libfaad/specrec.c 2017-03-12 20:16:58.305887783 +0100
20 +++ faad2/libfaad/specrec.c 2017-03-25 03:48:19.875321643 +0100
21 @@ -1110,13 +1110,13 @@
22 #ifdef PROFILE
23 int64_t count = faad_get_ts();
24 #endif
25 - if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
26 + if (hDecoder->element_alloced[hDecoder->fr_ch_ele] != 2)
28 retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel);
29 if (retval > 0)
30 return retval;
32 - hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1;
33 + hDecoder->element_alloced[hDecoder->fr_ch_ele] = 2;
36 /* dequantisation and scaling */