summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2014-09-20 16:32:31 -0700
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2014-09-20 16:39:48 -0700
commite64da8c20df3ec28bd2417924b207b870e9ab99f (patch)
tree2086ff13b56f9599297eefd969852505922a2555
parent00525b824af4265e7fc74d3655a04da9c4c667f7 (diff)
downloadphp-git-e64da8c20df3ec28bd2417924b207b870e9ab99f.tar.gz
Fixed bug #66242 (don't assume char is signed)
This fixes a bug in libmagic where a cast to 'char' is assumed to result in sign extension to occur. However, unqualified 'char' is unsigned on architectures such as ARM, so the cast needs to be to 'signed char' explicitly. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r--ext/fileinfo/libmagic/apprentice.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index fd82564bff..b137405da2 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -1269,7 +1269,7 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
* the sign extension must have happened.
*/
case FILE_BYTE:
- v = (char) v;
+ v = (signed char) v;
break;
case FILE_SHORT:
case FILE_BESHORT: