[
https://issues.apache.org/jira/browse/LUCENE-8165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16356399#comment-16356399
]
Robert Muir commented on LUCENE-8165:
-------------------------------------
For the record copyOf does similar lenient filling, but will be even trickier
to clean up since about half the uses i see are arguably "valid" (explicitly
oversizing arrays for future growth) and the other half are definitely
invalid... e.g. when you see it used in asserts in tests, etc, thats wrong.
We need to nuke it too: we should use the standard ArrayUtil.grow() for this
stuff, so the code is clear, too. And those methods can use arraycopy under the
hood.
> ban Arrays.copyOfRange with forbidden APIs
> ------------------------------------------
>
> Key: LUCENE-8165
> URL: https://issues.apache.org/jira/browse/LUCENE-8165
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Robert Muir
> Priority: Major
> Attachments: LUCENE-8165_start.patch, LUCENE-8165_start.patch
>
>
> This method is no good, because instead of throwing AIOOBE for bad bounds, it
> will silently fill with zeros (essentially silent corruption). Unfortunately
> it is used in quite a few places so replacing it with e.g. arrayCopy may
> uncover some interesting surprises.
> See LUCENE-8164 for motivation.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]