The AAC plugin sometimes does not check the length of available data
when checking for magic prefixes.  Add length checks.
---

 src/inputPlugins/aac_plugin.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c
index b48d985..7a91376 100644
--- a/src/inputPlugins/aac_plugin.c
+++ b/src/inputPlugins/aac_plugin.c
@@ -196,7 +196,7 @@ static void initAacBuffer(InputStream * inStream, AacBuffer 
* b, float *length)
        fillAacBuffer(b);
 
        tagsize = 0;
-       if (!memcmp(b->buffer, "ID3", 3)) {
+       if (b->bytesIntoBuffer >= 10 && !memcmp(b->buffer, "ID3", 3)) {
                tagsize = (b->buffer[6] << 21) | (b->buffer[7] << 14) |
                    (b->buffer[8] << 7) | (b->buffer[9] << 0);
 
@@ -208,7 +208,8 @@ static void initAacBuffer(InputStream * inStream, AacBuffer 
* b, float *length)
        if (length == NULL)
                return;
 
-       if ((b->buffer[0] == 0xFF) && ((b->buffer[1] & 0xF6) == 0xF0)) {
+       if (b->bytesIntoBuffer >= 2 &&
+           (b->buffer[0] == 0xFF) && ((b->buffer[1] & 0xF6) == 0xF0)) {
                adtsParse(b, length);
                seekInputStream(b->inStream, tagsize, SEEK_SET);
 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to