[FFmpeg-cvslog] avcodec/xpmdec: make convert function more picky about its input
Paul B Mahol
git at videolan.org
Sun Mar 12 19:28:25 EET 2017
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Mar 12 12:48:01 2017 +0100| [eda78c8b7f8a0e4728344f97700960f022eee6d2] | committer: Paul B Mahol
avcodec/xpmdec: make convert function more picky about its input
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eda78c8b7f8a0e4728344f97700960f022eee6d2
---
libavcodec/xpmdec.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
index 3f01a8f..8d5bc76 100644
--- a/libavcodec/xpmdec.c
+++ b/libavcodec/xpmdec.c
@@ -185,15 +185,16 @@ static const ColorEntry color_table[] = {
{ "YellowGreen", 0xFF9ACD32 }
};
-static int convert(uint8_t x)
+static unsigned convert(uint8_t x)
{
- if (x >= 'a') {
+ if (x >= 'a' && x <= 'f')
x -= 87;
- } else if (x >= 'A') {
+ else if (x >= 'A' && x <= 'F')
x -= 55;
- } else {
+ else if (x >= '0' && x <= '9')
x -= '0';
- }
+ else
+ x = 0;
return x;
}
More information about the ffmpeg-cvslog
mailing list