pitrou opened a new pull request, #54939:
URL: https://github.com/apache/arrow/pull/54939

   ### Rationale for this change
   
   When loading a MapArray from IPC, we call 
[`MapArray::ValidateChildData`](https://github.com/apache/arrow/blob/b9479757dd5c1914c2b007f11f6679c4fc080c05/cpp/src/arrow/ipc/reader.cc#L456-L459)
 to avoid a later crash in `MapArray::SetData`.
   
   Unfortunately `MapArray::ValidateChildData` calls `GetNullCount()` which is 
unsafe if the advertised length is too large for the actual validity buffer 
size.
   
   Found by OSS-Fuzz in https://issues.oss-fuzz.com/issues/556994537
   
   ### What changes are included in this PR?
   
   Check that the `null_count` of the relevant fields is equal to zero, so that 
`GetNullCount` does not actually try to read buffer memory.
   
   ### Are these changes tested?
   
   Yes, by additional fuzz regression test.
   
   ### Are there any user-facing changes?
   
   Just a bugfix.
   
   **This PR contains a "Critical Fix".** An invalid IPC file would lead to 
reading memory out of bounds for the purpose of counting validity bits. It is 
not obvious how this could be exploited by an attacker except for causing a 
denial of service.
   
   ### Was AI used for this PR?
   
   **PR code and description written by:**
   
   - [x] Human
   - [ ] AI
   
   **Reviewed before submission by:**
   
   - [x] Human
   - [ ] AI
   - [ ] Not reviewed
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to