avformat/rtpdec_xiph: Move pkt_len onto one side of the check
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 12 May 2015 16:07:32 +0000 (18:07 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 12 May 2015 16:07:32 +0000 (18:07 +0200)
This is more correct
Fixes CID1271793

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/rtpdec_xiph.c

index 8492865..eceb840 100644 (file)
@@ -73,7 +73,7 @@ static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
         }
         pkt_len = AV_RB16(data->split_buf + data->split_pos);
         data->split_pos += 2;
-        if (data->split_pos + pkt_len > data->split_buf_len) {
+        if (pkt_len > data->split_buf_len - data->split_pos) {
             av_log(ctx, AV_LOG_ERROR, "Not enough data to return\n");
             return AVERROR_INVALIDDATA;
         }