Skip to content

Commit

Permalink
Merge pull request #328 from defunctl/master
Browse files Browse the repository at this point in the history
Throw exception if a resource fails to seek
  • Loading branch information
JamesHeinrich committed Jun 28, 2021
2 parents 4e5bcaf + 4978226 commit 227dd56
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion getid3/getid3.php
Original file line number Diff line number Diff line change
Expand Up @@ -2255,7 +2255,15 @@ protected function fseek($bytes, $whence=SEEK_SET) {
throw new getid3_exception('cannot fseek('.$pos.') because beyond PHP filesystem limit', 10);
}
}
return fseek($this->getid3->fp, $bytes, $whence);

$result = fseek($this->getid3->fp, $bytes, $whence);

// fseek returns 0 on success
if ($result !== 0) {
throw new getid3_exception('cannot fseek('.$pos.'). resource/stream does not appear to support seeking', 10);
}

return $result;
}

/**
Expand Down

0 comments on commit 227dd56

Please sign in to comment.