fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

in_syslog: Fix double free when no parser is set

Open belzerus opened this issue 1 year ago • 0 comments

When running syslog example: bin/fluent-bit -i syslog -o stdout -f 1

if no parser is set we get a double-free:

  [2024/06/18 15:36:32] [ info] [fluent bit] version=3.1.0, commit=2bef95819e, pid=144050
  [2024/06/18 15:36:32] [ info] [storage] ver=1.5.2, type=memory, sync=normal, checksum=off, m  ax_chunks_up=128
  [2024/06/18 15:36:32] [ info] [cmetrics] version=0.9.1
  [2024/06/18 15:36:32] [ info] [ctraces ] version=0.5.1
  free(): double free detected in tcache 2
  [2024/06/18 15:36:32] [ info] [input:syslog:syslog.0] initializing
  zsh: IOT instruction  bin/fluent-bit -i syslog -o stdout -f 1

Remove the redundent flb_log_event_encoder_destroy, since that is already done in syslog_conf_destroy.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing Before we can approve your change; please submit the following in a comment:

  • [x] Example configuration file for the change bin/fluent-bit -i syslog -o stdout -f 1
  • [x] Debug log output from testing the change

"parser not set" is displayed.

[2024/06/18 15:53:08] [ info] [fluent bit] version=3.1.0, commit=2bef95819e, pid=145607
[2024/06/18 15:53:08] [ info] [storage] ver=1.5.2, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2024/06/18 15:53:08] [ info] [cmetrics] version=0.9.1
[2024/06/18 15:53:08] [ info] [ctraces ] version=0.5.1
[2024/06/18 15:53:08] [ info] [input:syslog:syslog.0] initializing
[2024/06/18 15:53:08] [ info] [input:syslog:syslog.0] storage_strategy='memory' (memory only)
[2024/06/18 15:53:08] [error] [in_syslog] parser not set
[2024/06/18 15:53:08] [error] [input:syslog:syslog.0] could not initialize plugin
[2024/06/18 15:53:08] [error] failed initialize input syslog.0
[2024/06/18 15:53:08] [error] [engine] input initialization failed
  • [x] Attached Valgrind output that shows no leaks or memory corruption was found

Same output as before this fix, when running valgrind.

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • [ ] Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

belzerus avatar Jun 18 '24 14:06 belzerus