all repos — mgba @ 74fcdf54e048f118df070bc7fbfa3e70e5c95495

mGBA Game Boy Advance Emulator

Fix reading more than a block but less than the rest of the file
Jeffrey Pfau jeffrey@endrift.com
Thu, 17 Jul 2014 02:51:38 -0700
commit

74fcdf54e048f118df070bc7fbfa3e70e5c95495

parent

793a89d091c4756e041a8702362ea61b80692b15

1 files changed, 2 insertions(+), 2 deletions(-)

jump to
M src/util/vfs-zip.csrc/util/vfs-zip.c

@@ -134,8 +134,8 @@ while (bytesRead < size) {

if (vfz->offset < vfz->readSize) { size_t diff = vfz->readSize - vfz->offset; void* start = &((uint8_t*) vfz->buffer)[vfz->offset]; - if (diff > size) { - diff = size; + if (diff > size - bytesRead) { + diff = size - bytesRead; } if (buffer) { void* bufferOffset = &((uint8_t*) buffer)[bytesRead];