diff options
author | Andy Wingo <wingo@pobox.com> | 2008-03-18 10:12:40 +0000 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2008-03-18 10:12:40 +0000 |
commit | 603b409c33ecc45e2e9b42e368ada98ff0c14d94 (patch) | |
tree | bb711123b5c6253a22b88ec7a595e717b3b571b1 | |
parent | 0361555869bfd91785b5c67700f59e1f08d3b063 (diff) | |
download | gst-plugins-bad-603b409c33ecc45e2e9b42e368ada98ff0c14d94.tar.gz gst-plugins-bad-603b409c33ecc45e2e9b42e368ada98ff0c14d94.tar.bz2 gst-plugins-bad-603b409c33ecc45e2e9b42e368ada98ff0c14d94.zip |
ext/faad/gstfaad.c (gst_faad_chain): Fix a bad format argument, and a potential int overflow.
Original commit message from CVS:
2008-03-18 Andy Wingo <wingo@pobox.com>
* ext/faad/gstfaad.c (gst_faad_chain): Fix a bad format argument,
and a potential int overflow.
* ext/faad/gstfaad.h: Include <neaacdec.h> if faad is neaac.
Avoids a #warning about an ignored #pragma.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ext/faad/gstfaad.c | 10 | ||||
-rw-r--r-- | ext/faad/gstfaad.h | 4 |
3 files changed, 21 insertions, 1 deletions
@@ -1,3 +1,11 @@ +2008-03-18 Andy Wingo <wingo@pobox.com> + + * ext/faad/gstfaad.c (gst_faad_chain): Fix a bad format argument, + and a potential int overflow. + + * ext/faad/gstfaad.h: Include <neaacdec.h> if faad is neaac. + Avoids a #warning about an ignored #pragma. + 2008-03-17 Zaheer Abbas Merali <zaheerabbas at merali dot org> * examples/switch/switcher.c: diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c index 1ddaf28f..0d482310 100644 --- a/ext/faad/gstfaad.c +++ b/ext/faad/gstfaad.c @@ -1337,12 +1337,20 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer) } } + if (info.samples > G_MAXUINT / faad->bps) { + /* C's lovely propensity for int overflow.. */ + GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL), + ("Output buffer too large")); + ret = GST_FLOW_ERROR; + goto out; + } + /* play decoded data */ if (info.samples > 0) { guint bufsize = info.samples * faad->bps; guint num_samples = info.samples / faad->channels; - GST_DEBUG_OBJECT (faad, "decoded %d samples", info.samples); + GST_DEBUG_OBJECT (faad, "decoded %d samples", (guint) info.samples); /* note: info.samples is total samples, not per channel */ ret = diff --git a/ext/faad/gstfaad.h b/ext/faad/gstfaad.h index 4297e985..7c20a01f 100644 --- a/ext/faad/gstfaad.h +++ b/ext/faad/gstfaad.h @@ -21,7 +21,11 @@ #define __GST_FAAD_H__ #include <gst/gst.h> +#ifdef FAAD_IS_NEAAC +#include <neaacdec.h> +#else #include <faad.h> +#endif G_BEGIN_DECLS |