diff mbox

[FFmpeg-devel] lavc/xpmdec: Allow more colours per character

Message ID CAB0OVGpn8JeR+3cj347w0t_izNJYDbEfOBTzhNrkFo4_rYDOKA@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Dec. 6, 2018, 6:11 p.m. UTC
Hi!

Attached patch fixes decoding the files attached to ticket #6234.

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos Dec. 10, 2018, 2:12 a.m. UTC | #1
2018-12-06 19:11 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:

> Attached patch fixes decoding the files attached to ticket #6234.
>
> Please comment, Carl Eugen

Ping.

Carl Eugen
Paul B Mahol Dec. 10, 2018, 3:49 p.m. UTC | #2
On 12/10/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 2018-12-06 19:11 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:
>
>> Attached patch fixes decoding the files attached to ticket #6234.
>>
>> Please comment, Carl Eugen
>
> Ping.

Probably ok.
Carl Eugen Hoyos Dec. 10, 2018, 8:06 p.m. UTC | #3
2018-12-10 16:49 GMT+01:00, Paul B Mahol <onemda@gmail.com>:
> On 12/10/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>> 2018-12-06 19:11 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:
>>
>>> Attached patch fixes decoding the files attached to ticket #6234.
>>>
>>> Please comment, Carl Eugen
>>
>> Ping.
>
> Probably ok.

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

From b0a5a2d675e1fa054a9297bcdb0e46239573cd9d Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Thu, 6 Dec 2018 19:09:56 +0100
Subject: [PATCH] lavc/xpmdec: Allow more colours per character.

Fixes ticket #6234.
---
 libavcodec/xpmdec.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
index 03172e4..1aa40c0 100644
--- a/libavcodec/xpmdec.c
+++ b/libavcodec/xpmdec.c
@@ -290,10 +290,10 @@  static int ascii2index(const uint8_t *cpixel, int cpp)
     int n = 0, m = 1, i;
 
     for (i = 0; i < cpp; i++) {
-        if (*p < ' ' || *p > '~')
+        if (*p < ' ' || *p > 0xfe)
             return AVERROR_INVALIDDATA;
         n += (*p++ - ' ') * m;
-        m *= 95;
+        m *= 220;
     }
     return n;
 }
@@ -346,7 +346,7 @@  static int xpm_decode_frame(AVCodecContext *avctx, void *data,
 
     size = 1;
     for (i = 0; i < cpp; i++)
-        size *= 95;
+        size *= 220;
 
     if (ncolors <= 0 || ncolors > size) {
         av_log(avctx, AV_LOG_ERROR, "invalid number of colors: %d\n", ncolors);
-- 
1.7.10.4