summaryrefslogtreecommitdiffstats
path: root/src/libdca-5-avoid-crashing-with-invalid-frames.patch
diff options
context:
space:
mode:
Diffstat (limited to 'src/libdca-5-avoid-crashing-with-invalid-frames.patch')
-rw-r--r--src/libdca-5-avoid-crashing-with-invalid-frames.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/libdca-5-avoid-crashing-with-invalid-frames.patch b/src/libdca-5-avoid-crashing-with-invalid-frames.patch
new file mode 100644
index 0000000..cd14444
--- /dev/null
+++ b/src/libdca-5-avoid-crashing-with-invalid-frames.patch
@@ -0,0 +1,31 @@
+This file is part of MXE.
+See index.html for further information.
+
+Taken from libdca svn: svn://svn.videolan.org/libdca/trunk.
+
+r89 | sam | 2008-07-19 22:26:17 +0000 (Sat, 19 Jul 2008) | 2 lines
+ * parse.c: avoid crashing with invalid frames setting a bitalloc_huffman
+ component to 7.
+
+--- libdca.orig/libdca/parse.c
++++ libdca/libdca/parse.c
+@@ -364,7 +364,10 @@
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ state->bitalloc_huffman[i] = bitstream_get (state, 3);
+- /* if (state->bitalloc_huffman[i] == 7) bailout */
++ /* There might be a way not to trash the whole frame, but for
++ * now we must bail out or we will buffer overflow later. */
++ if (state->bitalloc_huffman[i] == 7)
++ return 1;
+ #ifdef DEBUG
+ fprintf (stderr, "bit allocation quantizer: %i\n",
+ state->bitalloc_huffman[i]);
+@@ -541,6 +544,7 @@
+ k < state->vq_start_subband[j] &&
+ state->bitalloc[j][k] > 0)
+ {
++ /* tmode cannot overflow since transient_huffman[j] < 4 */
+ state->transition_mode[j][k] = InverseQ (state,
+ tmode[state->transient_huffman[j]]);
+ }