summaryrefslogtreecommitdiff
path: root/source/fitz/stream-read.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-09-14 12:03:54 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-09-14 16:31:00 +0200
commit2d3a7fefffb26949c0103429c5eb151e93c0ecef (patch)
tree38d5642cd8004e5c175772bc6d100201df7fe147 /source/fitz/stream-read.c
parent3af324c153f68455c82e9be4ac8bce67315f8fd8 (diff)
downloadmupdf-2d3a7fefffb26949c0103429c5eb151e93c0ecef.tar.xz
Fix truncation bug when comparing EOF to uint16_t values.
Diffstat (limited to 'source/fitz/stream-read.c')
-rw-r--r--source/fitz/stream-read.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/fitz/stream-read.c b/source/fitz/stream-read.c
index 927addb0..80091046 100644
--- a/source/fitz/stream-read.c
+++ b/source/fitz/stream-read.c
@@ -188,9 +188,9 @@ fz_read_file(fz_context *ctx, const char *filename)
uint16_t fz_read_uint16(fz_context *ctx, fz_stream *stm)
{
- uint16_t a = fz_read_byte(ctx, stm);
- uint16_t b = fz_read_byte(ctx, stm);
- uint16_t x = (a<<8) | (b);
+ uint32_t a = fz_read_byte(ctx, stm);
+ uint32_t b = fz_read_byte(ctx, stm);
+ uint32_t x = (a<<8) | (b);
if (a == EOF || b == EOF)
fz_throw(ctx, FZ_ERROR_GENERIC, "premature end of file in int16");
return x;
@@ -237,9 +237,9 @@ uint64_t fz_read_uint64(fz_context *ctx, fz_stream *stm)
uint16_t fz_read_uint16_le(fz_context *ctx, fz_stream *stm)
{
- uint16_t a = fz_read_byte(ctx, stm);
- uint16_t b = fz_read_byte(ctx, stm);
- uint16_t x = (a) | (b<<8);
+ uint32_t a = fz_read_byte(ctx, stm);
+ uint32_t b = fz_read_byte(ctx, stm);
+ uint32_t x = (a) | (b<<8);
if (a == EOF || b == EOF)
fz_throw(ctx, FZ_ERROR_GENERIC, "premature end of file in int16");
return x;