You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Nayana-Naik73 (via GitHub)" <gi...@apache.org> on 2026/10/19 17:14:12 UTC
[PR] [C++][Compute] Ignore null view sizes when casting binary_view to binary [arrow]
Nayana-Naik73 opened a new pull request, #54640:
URL: https://github.com/apache/arrow/pull/54640
### Rationale for this change
The view to offset-string cast (`binary_view`/`utf8_view` to `binary`, `utf8`, `large_binary`, `large_utf8`) reserves the output data buffer with `SumOfBinaryViewSizes` over every view, null slots included, and then copies each non-null value with `UnsafeAppend`. Views under a null bit are undefined and `ValidateFull` skips them, so a null view carrying a negative size (for example one read from an IPC or Parquet file) shrinks the reservation and the cast writes past the end of the output buffer. With `["foofoofoofoofoo", null, "barbarbarbarbarbarbar"]` and size -36 on the null view, the array passes `ValidateFull()` and ASan reports a WRITE overflow in `BufferBuilder::UnsafeAppend` from `BinaryToBinaryCastExec`.
### What changes are included in this PR?
The reservation now only sums the sizes of valid views, walking the validity bitmap with `VisitSetBitRunsVoid`.
### Are these changes tested?
Yes. `Cast.BinaryViewToBinaryNullViewSize` builds a `ValidateFull`-clean `utf8_view`/`binary_view` array with a negative size on the null view and casts it to all four offset types. It fails under ASan before the change and passes after; the rest of `arrow-compute-scalar-cast-test` passes too.
### Are there any user-facing changes?
No.
**This PR contains a "Critical Fix".** It fixes an out-of-bounds heap write in `cast` on valid input data whose null views hold a negative size.
### Was AI used for this PR?
In accordance to the [AI generation guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code), please disclose below whether and how AI was used in this PR.
**PR code and description written by:**
- [x] Human
- [x] 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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [C++][Compute] Ignore null view sizes when casting binary_view to binary [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #54640:
URL: https://github.com/apache/arrow/pull/54640#issuecomment-6272908286
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for opening a pull request!
**This pull request has been automatically closed because you currently have 4 open pull requests, which is more than the limit of 3.**
Due to the increase in pull requests opened by AI bots, and in order to keep the review queue manageable, Apache Arrow limits contributors without repository access to at most 3 concurrently open pull requests. This helps make sure each pull request gets the attention it needs and that work in progress does not go stale.
Once one of [your other open pull requests](https://github.com/apache/arrow/pulls/Nayana-Naik73) has been merged or closed, you are welcome to reopen this one.
See also:
* [Contribution Guidelines - Limit on concurrent pull requests](https://arrow.apache.org/docs/dev/developers/bug_reports.html#pr-limit)
* [Contribution Guidelines - Contributing Overview](https://arrow.apache.org/docs/developers/overview.html)
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [C++][Compute] Ignore null view sizes when casting binary_view to binary [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #54640: [C++][Compute] Ignore null view sizes when casting binary_view to binary
URL: https://github.com/apache/arrow/pull/54640
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [C++][Compute] Ignore null view sizes when casting binary_view to binary [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #54640:
URL: https://github.com/apache/arrow/pull/54640#issuecomment-6272908015
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for opening a pull request!
**This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format.**
If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes), could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
**After updating the title, you can mark the pull request as ready for review.**
See also:
* [Other pull requests](https://github.com/apache/arrow/pulls/)
* [Contribution Guidelines - Contributing Overview](https://arrow.apache.org/docs/developers/overview.html)
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org