Skip to content

Conversation

@joegallo
Copy link
Contributor

There's a byte array buffer size issue that can come up sometimes (it can be undersized) -- we need to account for the size of the prefix and suffix when doing that math on the buffer size.

@joegallo joegallo added >bug :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP Team:Data Management Meta label for data/management team v9.0.0 v8.18.0 v8.19.0 v9.1.0 v8.16.5 v8.17.3 labels Feb 14, 2025
@joegallo joegallo requested a review from davidkyle February 14, 2025 19:08
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine
Copy link
Collaborator

Hi @joegallo, I've created a changelog YAML for you.

Copy link
Member

@davidkyle davidkyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

*/
String redactMatches(byte[] utf8Bytes, String redactStartToken, String redactEndToken) {
var merged = mergeOverlappingReplacements(replacementPositions);
int longestPatternName = merged.stream().mapToInt(r -> r.patternName.getBytes(StandardCharsets.UTF_8).length).max().getAsInt();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

longestPatternName probably was a name once but now its the number of bytes in the longest name. Suggest longestPatternSize

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 on renaming, but since it's the max() of the length of the patternName(s), I went with maxPatternNameLength.

@joegallo joegallo added the auto-backport Automatically create backport pull requests when merged label Feb 17, 2025
@joegallo joegallo merged commit 846bf75 into elastic:main Feb 17, 2025
17 checks passed
@joegallo joegallo deleted the fix-redact-arraycopy-bug branch February 17, 2025 13:51
joegallo added a commit to joegallo/elasticsearch that referenced this pull request Feb 17, 2025
joegallo added a commit to joegallo/elasticsearch that referenced this pull request Feb 17, 2025
joegallo added a commit to joegallo/elasticsearch that referenced this pull request Feb 17, 2025
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.0
8.18
8.x
8.16
8.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged >bug :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP Team:Data Management Meta label for data/management team v8.16.5 v8.17.3 v8.18.0 v8.19.0 v9.0.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants