Don't try to read negative file sizes.
Return an error code for negative file sizes.
Merge pull request #7058 from unknownbrackets/io-minor

Handle negative read sizes more correctly