OSDN Git Service
(root)
/
android-x86
/
external-ffmpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5dab7b9
)
avcodec/xpmdec: make convert function more picky about its input
author
Paul B Mahol
<onemda@gmail.com>
Sun, 12 Mar 2017 11:48:01 +0000
(12:48 +0100)
committer
Paul B Mahol
<onemda@gmail.com>
Sun, 12 Mar 2017 17:24:49 +0000
(18:24 +0100)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/xpmdec.c
patch
|
blob
|
history
diff --git
a/libavcodec/xpmdec.c
b/libavcodec/xpmdec.c
index
3f01a8f
..
8d5bc76
100644
(file)
--- 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;
}