Fixed crash on zero-byte read/write (thanks, Ensiform!).
This commit is contained in:
parent
fc6d85b2f4
commit
87f7eb152a
|
@ -4,6 +4,7 @@
|
|||
|
||||
-- stuff in the stable-1.0 branch, backported from 2.0.0 dev branch, etc ---
|
||||
|
||||
07112007 - Fixed crash on zero-byte read/write (thanks, Ensiform!).
|
||||
05052007 - Fixed zip archiver: could do bogus seek if a small, non-zip file
|
||||
got put through isArchive().
|
||||
04022007 - Fixed Doxygen comment.
|
||||
|
|
4
physfs.c
4
physfs.c
|
@ -1797,6 +1797,8 @@ PHYSFS_sint64 PHYSFS_read(PHYSFS_file *handle, void *buffer,
|
|||
FileHandle *h = (FileHandle *) handle->opaque;
|
||||
|
||||
BAIL_IF_MACRO(!h->forReading, ERR_FILE_ALREADY_OPEN_W, -1);
|
||||
BAIL_IF_MACRO(objSize == 0, NULL, 0);
|
||||
BAIL_IF_MACRO(objCount == 0, NULL, 0);
|
||||
if (h->buffer != NULL)
|
||||
return(doBufferedRead(handle, buffer, objSize, objCount));
|
||||
|
||||
|
@ -1830,6 +1832,8 @@ PHYSFS_sint64 PHYSFS_write(PHYSFS_file *handle, const void *buffer,
|
|||
FileHandle *h = (FileHandle *) handle->opaque;
|
||||
|
||||
BAIL_IF_MACRO(h->forReading, ERR_FILE_ALREADY_OPEN_R, -1);
|
||||
BAIL_IF_MACRO(objSize == 0, NULL, 0);
|
||||
BAIL_IF_MACRO(objCount == 0, NULL, 0);
|
||||
if (h->buffer != NULL)
|
||||
return(doBufferedWrite(handle, buffer, objSize, objCount));
|
||||
|
||||
|
|
Loading…
Reference in New Issue