|Summary:||PushbackInputStreams passed to ZipHelper may not hold 8 bytes|
|Product:||POI||Reporter:||Kenzie Togami <ket1999>|
|Component:||OPC||Assignee:||POI Developers List <dev>|
Description Kenzie Togami 2017-08-04 01:55:33 UTC
Created attachment 35200 [details] Example ZipHelper tries to be efficient when checking the header by reusing PushbackInputStreams that are given as input, but these streams may not hold the 8 bytes that are pushed back, and can cause an exception. Testable example is attached. Workaround: Wrap InputStreams in BufferedInputStream before passing them to anything that uses ZipHelper. Solutions: - always create a new PushbackInputStream - stop using PushbackInputStream and switch to mark/reset + BufferedInputStream
Comment 1 Andreas Beeker 2017-08-06 17:20:16 UTC
Thanks for pointing this out. I'm currently replacing the PushbackInputStream calls (option 2) and refactor the file magic checks in one spot.