Skip to contentSkip to conversation

android/audio_utils/resampler : Fix the null pointer dereference.

PATCH In review gowtham babu 2 participants 2 messages Sep 5, 2014 – Sep 9, 2014 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 android/audio_utils/resampler : Fix the null pointer dereference.

Checks for NULL.

---
 android/audio_utils/resampler.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
android/audio_utils/resampler.c +4 -2
index ce30375..f845e2c 100644
@@ -50,8 +50,10 @@ static void resampler_reset(struct resampler_itfe *resampler)
 {
     struct resampler *rsmp = (struct resampler *)resampler;
 
-    rsmp->frames_in = 0;
-    rsmp->frames_rq = 0;
+    if(rsmp != NULL) {
+	rsmp->frames_in = 0;
+	rsmp->frames_rq = 0;
+    }
 
     if (rsmp != NULL && rsmp->speex_resampler != NULL) {
         speex_resampler_reset_mem(rsmp->speex_resampler);
Signature · 1 line
1.9.1
#1 lore raw

Hi,

Quoted 23 lines · gowtham babu

Checks for NULL.

---
 android/audio_utils/resampler.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
android/audio_utils/resampler.c +4 -3
index ce30375..f845e2c 100644
@@ -50,8 +50,10 @@ static void resampler_reset(struct resampler_itfe *resampler)
 {
     struct resampler *rsmp = (struct resampler *)resampler;
 
-    rsmp->frames_in = 0;
-    rsmp->frames_rq = 0;
+    if(rsmp != NULL) {
+       rsmp->frames_in = 0;
+       rsmp->frames_rq = 0;
+    }
 
     if (rsmp != NULL && rsmp->speex_resampler != NULL) {
         speex_resampler_reset_mem(rsmp->speex_resampler);
--
Quoted 1 line

1.9.1

Im afraid this was copied from Android so I would not bother with it except if you want to send the patch to Android itself.

Signature · 1 line
Luiz Augusto von Dentz