* Do not fuzz anything if 0 bytes were read.
* Added a debug message for fuzzing.
This commit is contained in:
@@ -42,8 +42,10 @@ void _zz_fuzz(int fd, uint8_t *buf, uint64_t len)
|
||||
unsigned long int pos = _zz_getpos(fd);
|
||||
unsigned int i, j, todo;
|
||||
|
||||
fuzz = _zz_getfuzz(fd);
|
||||
debug("fuzz(%i, %lli@%li)", fd, (unsigned long long int)len,
|
||||
(unsigned long int)pos);
|
||||
|
||||
fuzz = _zz_getfuzz(fd);
|
||||
aligned_buf = buf - pos;
|
||||
|
||||
for(i = pos / CHUNKBYTES;
|
||||
|
||||
@@ -167,8 +167,11 @@ size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
/* XXX: the number of bytes read is not ret * size, because
|
||||
* a partial read may have advanced the stream pointer */
|
||||
long int newpos = ftell(stream);
|
||||
_zz_fuzz(fd, ptr, newpos - pos);
|
||||
_zz_setpos(fd, newpos);
|
||||
if(newpos != pos)
|
||||
{
|
||||
_zz_fuzz(fd, ptr, newpos - pos);
|
||||
_zz_setpos(fd, newpos);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user