summaryrefslogtreecommitdiff
path: root/libavcodec/mss1.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-28 00:42:47 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-28 01:08:52 +0200
commit87df986dcf90dcda2d10d9c3b3c84656cdd032aa (patch)
treef7c506a9a96b3df41f392a558a1f9add4f9ff013 /libavcodec/mss1.c
parentee7214c59a2641389bec9e9598345c7a58f1e173 (diff)
parent15358ade152ebc28fcc824e09ad9206597c281df (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: mss1: validate number of changeable palette entries mss1: report palette changed when some additional colours were decoded x86: fft: replace call to memcpy by a loop udp: Support IGMPv3 source specific multicast and source blocking dxva2: include dxva.h if found libm: Provide fallback definitions for isnan() and isinf() tcp: Pass NULL as hostname to getaddrinfo if the string is empty tcp: Set AI_PASSIVE when the socket will be used for listening Conflicts: configure libavcodec/mss1.c libavformat/udp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mss1.c')
-rw-r--r--libavcodec/mss1.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c
index 6163ecf26e..6299037d01 100644
--- a/libavcodec/mss1.c
+++ b/libavcodec/mss1.c
@@ -557,7 +557,7 @@ static int decode_pal(MSS1Context *ctx, ArithCoder *acoder)
*pal++ = (0xFF << 24) | (r << 16) | (g << 8) | b;
}
- return 1;
+ return !!ncol;
}
static int decode_pivot(MSS1Context *ctx, ArithCoder *acoder, int base)
@@ -783,8 +783,10 @@ static av_cold int mss1_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d\n",
AV_RB32(avctx->extradata + 4), AV_RB32(avctx->extradata + 8));
c->free_colours = AV_RB32(avctx->extradata + 48);
- if (c->free_colours < 0 || c->free_colours > 256) {
- av_log(avctx, AV_LOG_ERROR, "Invalid free colours %d\n", c->free_colours);
+ if ((unsigned)c->free_colours > 256) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Incorrect number of changeable palette entries: %d\n",
+ c->free_colours);
return AVERROR_INVALIDDATA;
}
av_log(avctx, AV_LOG_DEBUG, "%d free colour(s)\n", c->free_colours);