alsa/0038-route-Fix-invalid-pointer-access.patch
Takashi Iwai 0f3ddbbd7b Accepting request 228907 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes:
  0037-route-Return-NULL-in-case-of-zero-found-channels-in-.patch
  0038-route-Fix-invalid-pointer-access.patch
  0039-pcm-ladspa-Delay-LADSPA-plugin-activate-call.patch
- Remove the temporary fix that has been replaced by the fixes
  above:
  0037-pcm-route-Don-t-handle-no-matching-chmap-as-a-seriou.patch

OBS-URL: https://build.opensuse.org/request/show/228907
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=158
2014-04-03 15:22:24 +00:00

42 lines
1.3 KiB
Diff

From dbe6d7f86902dbbe2ff276b7a6524c084893772f Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 19 Mar 2014 10:52:24 +0100
Subject: [PATCH] route: Fix invalid pointer access
An uninitialized chmap pointer value is assigned in
_snd_pcm_route_open(). Add NULL initializations appropriately, and
also avoid the possible invalid access of NULL pcmp pointer.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_route.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c
index a9097caa7303..599fc3eb48e2 100644
--- a/src/pcm/pcm_route.c
+++ b/src/pcm/pcm_route.c
@@ -1361,7 +1361,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
int err;
snd_pcm_t *spcm;
snd_config_t *slave = NULL, *sconf;
- snd_pcm_chmap_t *tt_chmap, *chmap;
+ snd_pcm_chmap_t *tt_chmap = NULL, *chmap = NULL;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
int schannels = -1;
snd_config_t *tt = NULL;
@@ -1460,8 +1460,9 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
if (err < 0) {
free(chmap);
snd_pcm_close(spcm);
+ } else {
+ ((snd_pcm_route_t*) (*pcmp)->private_data)->chmap = chmap;
}
- ((snd_pcm_route_t*) (*pcmp)->private_data)->chmap = chmap;
return err;
}
--
1.9.1