gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libextractor] branch master updated: fix SIGFPE in wav plu


From: gnunet
Subject: [GNUnet-SVN] [libextractor] branch master updated: fix SIGFPE in wav plugin found by Leon Zhao
Date: Mon, 09 Oct 2017 15:30:27 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository libextractor.

The following commit(s) were added to refs/heads/master by this push:
     new b577d545 fix SIGFPE in wav plugin found by Leon Zhao
b577d545 is described below

commit b577d5452c5c4ee9d552da62a24b95f461551fe2
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Oct 9 15:30:25 2017 +0200

    fix SIGFPE in wav plugin found by Leon Zhao
---
 ChangeLog                   |  3 +++
 src/plugins/wav_extractor.c | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e432bec..313f54bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Mon Oct  9 15:30:01 CEST 2017
+       Fix SIGFPE in WAV plugin found by Leon Zhao. -CG
+
 Sun Apr 30 01:50:01 CEST 2017
        Updating French translation. -SA
 
diff --git a/src/plugins/wav_extractor.c b/src/plugins/wav_extractor.c
index 45d3d521..dae88907 100644
--- a/src/plugins/wav_extractor.c
+++ b/src/plugins/wav_extractor.c
@@ -49,7 +49,7 @@ little_endian_to_host32 (uint32_t in)
 {
   unsigned char *ptr = (unsigned char *) &in;
 
-  return ((ptr[3] & 0xFF) << 24) | ((ptr[2] & 0xFF) << 16) | 
+  return ((ptr[3] & 0xFF) << 24) | ((ptr[2] & 0xFF) << 16) |
     ((ptr[1] & 0xFF) << 8) | (ptr[0] & 0xFF);
 }
 #endif
@@ -81,7 +81,7 @@ EXTRACTOR_wav_extract_method (struct EXTRACTOR_ExtractContext 
*ec)
   uint32_t samples;
   char scratch[256];
 
-  if (44 > 
+  if (44 >
       ec->read (ec->cls,  &data, 44))
     return;
   buf = data;
@@ -109,6 +109,8 @@ EXTRACTOR_wav_extract_method (struct 
EXTRACTOR_ExtractContext *ec)
     return;                /* invalid sample size found in wav file */
   if (0 == channels)
     return;                /* invalid channels value -- avoid division by 0! */
+  if (0 == sample_rate)
+    return;                /* invalid sample_rate */
   samples = data_len / (channels * (sample_size >> 3));
 
   snprintf (scratch,
@@ -118,7 +120,7 @@ EXTRACTOR_wav_extract_method (struct 
EXTRACTOR_ExtractContext *ec)
             ? (samples * 1000 / sample_rate)
             : (samples / sample_rate) * 1000,
             sample_rate, (1 == channels) ? _("mono") : _("stereo"));
-  if (0 != ec->proc (ec->cls, 
+  if (0 != ec->proc (ec->cls,
                     "wav",
                     EXTRACTOR_METATYPE_RESOURCE_TYPE,
                     EXTRACTOR_METAFORMAT_UTF8,
@@ -126,7 +128,7 @@ EXTRACTOR_wav_extract_method (struct 
EXTRACTOR_ExtractContext *ec)
                     scratch,
                     strlen (scratch) + 1))
     return;
-  if (0 != ec->proc (ec->cls, 
+  if (0 != ec->proc (ec->cls,
                     "wav",
                     EXTRACTOR_METATYPE_MIMETYPE,
                     EXTRACTOR_METAFORMAT_UTF8,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]