History

filmstripdec: correctly check image dimensions

This prevents a division by zero in read_packet.

Andreas Cadhalpun committed 10 years ago

Commit 25012c51 parent 03cef341 file · +3 −4Browse files

Unified · Split

libavformat/filmstripdec.c+3−4
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 */
2626
2727 #include "libavutil/intreadwrite.h"
28+#include "libavutil/imgutils.h"
2829 #include "avformat.h"
2930 #include "internal.h"
3031
@@ -68,10 +69,8 @@ static int read_header(AVFormatContext *s) · 37 unmodified lines
6869 st->codecpar->height = avio_rb16(pb);
6970 film->leading = avio_rb16(pb);
7071
71− if (st->codecpar->width * 4LL * st->codecpar->height >= INT_MAX) {
72− av_log(s, AV_LOG_ERROR, "dimensions too large\n");
73− return AVERROR_PATCHWELCOME;
74− }
72+ if (av_image_check_size(st->codecpar->width, st->codecpar->height, 0, s) < 0)
73+ return AVERROR_INVALIDDATA;
7574
7675 avpriv_set_pts_info(st, 64, 1, avio_rb16(pb));
7776

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t