summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-08 22:32:42 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-10 21:01:59 +0100
commitc82b8ef0e4f226423ddd644bfe37e6a15d070924 (patch)
tree812b708311a9c5f3e3f27e49cde3a35c3854fb6a /libavcodec
parent1e33035ee7a8d9fb7a4b8b6cc54842e72b36ed70 (diff)
dvbsubdec: fix division by zero in compute_default_clut
This problem was introduced in commit 4b90dcb8493552c17a811c8b1e6538dae4061f9d. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dvbsubdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index e9f4765b15..bf3b1a1019 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -810,7 +810,7 @@ static void compute_default_clut(AVSubtitleRect *rect, int w, int h)
list_inv[ i ] = bestv;
}
- count = i - 1;
+ count = FFMAX(i - 1, 1);
for (i--; i>=0; i--) {
int v = i*255/count;
AV_WN32(rect->data[1] + 4*list_inv[i], RGBA(v/2,v,v/2,v));