Open Bug 605268 Opened 15 years ago Updated 3 years ago

nsIFileInputStream allows seeking past the end of the file

Categories

(Core :: Networking: File, defect, P5)

x86
All
defect

Tracking

()

People

(Reporter: sicking, Unassigned)

Details

(Whiteboard: [necko-would-take])

Currently, if you instantiate a file-input-stream and QI to nsISeekableStream you can seek past the end of the file. This is counter to what the nsISeekableStream::Seek documentation in the interface says. Not only can you seek past the end, but if you do, calling nsISeekableStream::Available gives very strange results. For example if you seek 10 bytes past the end, Available returns 4294967286 (2^32 - 10). But when just one byte past the end, an exception is thrown. This behaves the same way on all platforms. Unfortunately I can't think of a way to fix this without slowing down all SET and CUR seeks with a positive offset. I.e. making them call Available before performing the seek. I didn't really know who to cc on this bug. If you know of anyone who has good knowledge of platform APIs, please do cc them.
Whiteboard: [necko-would-take]
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.