aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-11 22:19:54 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-11 22:19:54 +0100
commit4809ac75fcefe198e70936d49160036818f12e2b (patch)
treed77d672bcb8549a708a48e0426b82bba485cba09
parent6229f7823e2a9b93a95ce27c10efc156a555c20d (diff)
parent2383323661f3b8342b2c4d356fcfe8c5d1b045f8 (diff)
downloadffmpeg-4809ac75fcefe198e70936d49160036818f12e2b.tar.gz
Merge commit '2383323661f3b8342b2c4d356fcfe8c5d1b045f8'
* commit '2383323661f3b8342b2c4d356fcfe8c5d1b045f8': dvbsubdec: improve error checking Conflicts: libavcodec/dvbsubdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/dvbsubdec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 021f9434b6..c45d568284 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -796,6 +796,9 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
if (sub->num_rects > 0) {
sub->rects = av_mallocz_array(sizeof(*sub->rects), sub->num_rects);
+ if (!sub->rects)
+ return AVERROR(ENOMEM);
+
for(i=0; i<sub->num_rects; i++)
sub->rects[i] = av_mallocz(sizeof(*sub->rects[i]));
@@ -838,9 +841,19 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
}
rect->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
+ if (!rect->pict.data[1]) {
+ av_free(sub->rects);
+ return AVERROR(ENOMEM);
+ }
memcpy(rect->pict.data[1], clut_table, (1 << region->depth) * sizeof(uint32_t));
rect->pict.data[0] = av_malloc(region->buf_size);
+ if (!rect->pict.data[0]) {
+ av_free(rect->pict.data[1]);
+ av_free(sub->rects);
+ return AVERROR(ENOMEM);
+ }
+
memcpy(rect->pict.data[0], region->pbuf, region->buf_size);
i++;