Potential fix for seeking too far into archived files

CQTexperiment
Chris Moeller 2015-02-22 11:56:51 -08:00
parent 6a66946823
commit b1b115d510
1 changed files with 2 additions and 0 deletions

View File

@ -144,6 +144,8 @@ static BOOL g_parse_unpack_path(NSString * src, NSString ** archive, NSString **
- (long)read:(void *)buffer amount:(long)amount - (long)read:(void *)buffer amount:(long)amount
{ {
if ( offset >= size )
return 0;
if ( size - offset < amount ) if ( size - offset < amount )
amount = size - offset; amount = size - offset;
memcpy( buffer, (const uint8_t *)data + offset, amount ); memcpy( buffer, (const uint8_t *)data + offset, amount );