]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: Fix segfault with 32bit libs
authorTakashi Iwai <tiwai@suse.de>
Sat, 9 Sep 2023 15:42:03 +0000 (17:42 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sat, 9 Sep 2023 15:42:03 +0000 (17:42 +0200)
The recent rearrangement of header inclusion order caused a regression
showing segfaults on 32bit Arm.  The primary reason is the
inconsistent compile condition depending on the inclusion of config.h;
while most of other code include pcm_local.h (that implicitly includes
config.h) at first, pcm_direct.c doesn't do it, hence the access with
direct plugins crashes.

For fixing it, we need to include config.h at the beginning.  But,
it's better to include pcm_local.h for all relevant code for
consistency.  The patch does it, and also it adds the guard in
pcm_local.h for double inclusions.

Fixes: ad3a8b8b314e ("reshuffle included files to include config.h as first")
Link: https://github.com/alsa-project/alsa-lib/issues/352
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_direct.c
src/pcm/pcm_dmix.c
src/pcm/pcm_dshare.c
src/pcm/pcm_dsnoop.c
src/pcm/pcm_local.h
src/pcm/pcm_shm.c

index 040fc1605388d7c1302dc9bcf64c27335e61e327..e53e592381191ec6b924e771e9aa9712c279cf6b 100644 (file)
@@ -19,6 +19,7 @@
  *
  */
   
+#include "pcm_local.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
index 7cd3c50841ae219c65731f7cb5ab32a1edcd99a3..55cae3e79a06f9c692e5e7f5c51a1cc03c6fb780 100644 (file)
@@ -26,7 +26,7 @@
  *
  */
   
-#include "config.h"
+#include "pcm_local.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
index 454b39a9142962a1ec955c1648ec10e7e4367518..c03290985457c4b0036afb78643e16966ec33d60 100644 (file)
@@ -26,6 +26,7 @@
  *
  */
   
+#include "pcm_local.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
index d3ce300ce3b8258b7506bad23088ad38033e0abb..bf67c68a0dfa8e514b73a966543df35a89f6a674 100644 (file)
@@ -26,6 +26,7 @@
  *
  */
   
+#include "pcm_local.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
index 6a0e71e711ea5b5b0d469220fa555c6c5bce656a..152c92c300e1eec324415009d5b61e86e2dcaa5e 100644 (file)
@@ -20,6 +20,9 @@
  *
  */
 
+#ifndef __PCM_LOCAL_H
+#define __PCM_LOCAL_H
+
 #include "config.h"
 
 #include <stdio.h>
@@ -1223,3 +1226,5 @@ static inline void snd_pcm_unlock(snd_pcm_t *pcm)
 #define snd_pcm_lock(pcm)              do {} while (0)
 #define snd_pcm_unlock(pcm)            do {} while (0)
 #endif /* THREAD_SAFE_API */
+
+#endif /* __PCM_LOCAL_H */
index f0bfd934d335eb44c6eeaf1fcf8c5eded917d550..d9596547741c1fb4076a4cf9e4be133656821301 100644 (file)
@@ -26,6 +26,7 @@
  *
  */
   
+#include "pcm_local.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>