[12/13] rtpdec_jpeg: Disallow using the reserved q values

Message ID 1347363979-4676-12-git-send-email-martin@martin.st
State Committed
Commit 1743938df10dd888484f964d5af8fd3957d26809
Headers show

Commit Message

Martin Storsjö Sept. 11, 2012, 11:46 a.m.
---
 libavformat/rtpdec_jpeg.c |    4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c
index 9c0e693..7809a9b 100644
--- a/libavformat/rtpdec_jpeg.c
+++ b/libavformat/rtpdec_jpeg.c
@@ -304,6 +304,10 @@  static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
                 qtable_len =  jpeg->qtables_len[q - 128];
             }
         } else { /* q <= 127 */
+            if (q == 0 || q > 99) {
+                av_log(ctx, AV_LOG_ERROR, "Reserved q value %d\n", q);
+                return AVERROR_INVALIDDATA;
+            }
             create_default_qtables(new_qtables, q);
             qtables    = new_qtables;
             qtable_len = sizeof(new_qtables);