pipewire/spa
Chengyi Zhao 91b10af3b8 alsa-pcm: Guard fflush/fclose on state->log_file with NULL check
When an ALSA device enters an inconsistent state, spa_alsa_clear()
may close log_file but later code paths (e.g., set_swparams) still
call fflush(state->log_file) or fclose(state->log_file). This can
lead to use-after-free or passing NULL to fclose, causing crashes.

Add NULL checks before fflush and fclose, and set log_file to NULL
after closing to prevent subsequent use.

Crash backtrace from an actual occurrence (invalid buf in log_write):

 #0  __GI___strchrnul_lasx
 #1  __GI_strcspn
 #2  log_write (cookie=0x5555667f3f08, buf=0x5555670c4000, size=...)
 #3  _IO_cookie_write
 ...
 #8  set_swparams
 #9  do_prepare
 #10 alsa_recover
2026-04-30 16:13:05 +08:00
..
examples spa: examples: fix getopt usage + typos in adapter-control 2025-10-26 14:12:19 +00:00
include security: fix format string vulnerability in hook.h example code 2026-04-29 11:33:44 +02:00
include-private/spa-private spa: move dbus helpers out of bluez plugin 2024-02-05 13:03:20 +00:00
lib spa: update lib.c 2026-03-09 18:33:32 +01:00
plugins alsa-pcm: Guard fflush/fclose on state->log_file with NULL check 2026-04-30 16:13:05 +08:00
tests spa/tests: remove unused #include <linux/limits.h> 2026-03-11 21:50:21 +00:00
tools tools: port various tools to the new json-builder 2026-02-26 10:51:17 +01:00
meson.build meson: Always use -fno-strict-aliasing and -fno-strict-overflow 2025-07-24 07:30:28 +00:00