Browse code

avformat/thp: Check av_get_packet() for failure not only for partial output

Fixes null pointer dereference
Fixes: signal_sigsegv_db2c1f_3108_cov_163322880_pikmin2_opening1_partial.thp

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f2579dbb4b31e6ae731e7f5555680528ef3020ab)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2015/02/05 11:45:21
Showing 1 changed files
... ...
@@ -180,6 +180,8 @@ static int thp_read_packet(AVFormatContext *s,
180 180
         pkt->stream_index = thp->video_stream_index;
181 181
     } else {
182 182
         ret = av_get_packet(pb, pkt, thp->audiosize);
183
+        if (ret < 0)
184
+            return ret;
183 185
         if (ret != thp->audiosize) {
184 186
             av_free_packet(pkt);
185 187
             return AVERROR(EIO);