Index: core/fxcodec/codec/fx_codec_tiff.cpp |
diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/fx_codec_tiff.cpp |
index c4c745587f31fd7fa3b215f49e3a17f360000746..952fbdfae0ee1615d6e10f3e3b1a431d3ee9469c 100644 |
--- a/core/fxcodec/codec/fx_codec_tiff.cpp |
+++ b/core/fxcodec/codec/fx_codec_tiff.cpp |
@@ -98,11 +98,14 @@ tsize_t tiff_read(thandle_t context, tdata_t buf, tsize_t length) { |
if (!increment.IsValid()) |
return 0; |
- if (!pTiffContext->io_in()->ReadBlock(buf, pTiffContext->offset(), length)) |
+ size_t readSize = |
+ pTiffContext->io_in()->ReadBlock(buf, pTiffContext->offset(), length); |
+ if (readSize != static_cast<size_t>(length) && |
+ !pTiffContext->io_in()->IsEOF()) |
return 0; |
- pTiffContext->set_offset(increment.ValueOrDie()); |
- return length; |
+ pTiffContext->set_offset(increment.ValueOrDie() - length + readSize); |
+ return readSize; |
} |
tsize_t tiff_write(thandle_t context, tdata_t buf, tsize_t length) { |