Describe the bug, including details regarding any error messages, version, and platform.
Description
ArrowReader.readStreaming(), ArrowReader.readFile(), and ArrowReader.fromMessage() crash with fatal errors when processing malformed or truncated Arrow files instead of returning error results.
Root Cause
Multiple locations in the reader use force unwrap (!) on optional values that can be nil when input is malformed:
- readStreaming (line 285-289): Assumes
schemaMessage and result.schema exist before using them
- readFile (line 338, 374-375): Assumes
footer.schema and result.schema exist without checking
- fromMessage (line 436): Assumes
result.messageSchema and result.schema exist
When these values are nil (due to missing/malformed schema, missing recordbatch header, etc.), the force unwrap causes a crash instead of returning a .failure result.
Example Triggers
- RecordBatch message without preceding Schema message
- Truncated file missing footer schema
- Malformed message headers
Expected Behavior
All malformed input should gracefully return ArrowError rather than crashing the application.
Affected Methods
readStreaming(_:useUnalignedBuffers:)
readFile(_:useUnalignedBuffers:)
fromMessage(_:dataBody:result:useUnalignedBuffers:)
Describe the bug, including details regarding any error messages, version, and platform.
Description
ArrowReader.readStreaming(),ArrowReader.readFile(), andArrowReader.fromMessage()crash with fatal errors when processing malformed or truncated Arrow files instead of returning error results.Root Cause
Multiple locations in the reader use force unwrap (
!) on optional values that can be nil when input is malformed:schemaMessageandresult.schemaexist before using themfooter.schemaandresult.schemaexist without checkingresult.messageSchemaandresult.schemaexistWhen these values are nil (due to missing/malformed schema, missing recordbatch header, etc.), the force unwrap causes a crash instead of returning a
.failureresult.Example Triggers
Expected Behavior
All malformed input should gracefully return
ArrowErrorrather than crashing the application.Affected Methods
readStreaming(_:useUnalignedBuffers:)readFile(_:useUnalignedBuffers:)fromMessage(_:dataBody:result:useUnalignedBuffers:)