Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.1](backport #30658) Fix dissect trim panics from DELETE (\u007f) character #30868

Merged
merged 2 commits into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...main[Check the HEAD dif
- Wildcard fields no longer have a default ignore_above setting of 1024. {issue}30096[30096] {pull}30668[30668]
- Ensure that the Reloadable part of beats are initialized before the Manager is started. {issue}30533[30533]
- Ignore bugfix version when running version compatibility check against Elasticsearch. {pull}30746[30746]
- Add more descriptive error logs for common connection failures in Kafka inputs / outputs. {pull}30776[30776]
- Fix dissect trim panics from DELETE (127)(\u007f) character {issue}30657[30657] {pull}30658[30658]

adriansr marked this conversation as resolved.
Show resolved Hide resolved
*Auditbeat*

Expand Down
2 changes: 1 addition & 1 deletion libbeat/processors/dissect/trim.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func newTrimmer(trimChars string, trimLeft, trimRight bool) (t trimmer, err erro
}

type asciiTrimmer struct {
chars [127]byte
chars [asciiLimit]byte
left, right bool
}

Expand Down
40 changes: 40 additions & 0 deletions libbeat/processors/dissect/trim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,46 @@ func TestTrimmer(t *testing.T) {
input: "\t\t༄𑅀߹꧁߹𑁍 ÿ",
expected: "༄𑅀߹꧁߹𑁍",
},
{ // demonstrates that unicode \u is converted to char in golang strings
name: "trim ASCII TILDE",
cutset: " ",
left: true,
right: true,
input: " hello world! \u007e ",
expected: "hello world! ~",
},
{
name: "trim ASCII DELETE",
cutset: " ",
left: true,
right: true,
input: " hello world! \u007f ",
expected: "hello world! \u007f",
},
{
name: "trim UTF-8 CONTROL",
cutset: " ",
left: true,
right: true,
input: " hello world! \u0080 ",
expected: "hello world! \u0080",
},
{
name: "trim ASCII DELETE cutset in UTF-8 input",
cutset: " \u007f",
left: true,
right: true,
input: " hello world! \u0080 \u007f",
expected: "hello world! \u0080",
},
{
name: "trim UTF-8 CONTROL cutset in UTF-8 input",
cutset: " \u0080",
left: true,
right: true,
input: " hello world! \u007f \u0080",
expected: "hello world! \u007f",
},
} {
t.Run(test.name, func(t *testing.T) {
trimmer, err := newTrimmer(test.cutset, test.left, test.right)
Expand Down