• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/audiofile/0004-clamp-index-values-to-fix-index-overflow-in-IMA.cpp.patch
Peter KorsgaardPeter Korsgaard committed 434890df2a730 Mar 2017
Raw file
Source viewDiff to previous
 
1
From 25eb00ce913452c2e614548d7df93070bf0d066f Mon Sep 17 00:00:00 2001
2
From: Antonio Larrosa <larrosa@kde.org>
3
Date: Mon, 6 Mar 2017 18:02:31 +0100
4
Subject: [PATCH] clamp index values to fix index overflow in IMA.cpp
5
​
6
This fixes #33
7
(also reported at https://bugzilla.opensuse.org/show_bug.cgi?id=1026981
8
and https://blogs.gentoo.org/ago/2017/02/20/audiofile-global-buffer-overflow-in-decodesample-ima-cpp/)
9
​
10
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
11
---
12
 libaudiofile/modules/IMA.cpp | 4 ++--
13
 1 file changed, 2 insertions(+), 2 deletions(-)
14
​
15
diff --git a/libaudiofile/modules/IMA.cpp b/libaudiofile/modules/IMA.cpp
16
index 7476d44..df4aad6 100644
17
--- a/libaudiofile/modules/IMA.cpp
18
+++ b/libaudiofile/modules/IMA.cpp
19
@@ -169,7 +169,7 @@ int IMA::decodeBlockWAVE(const uint8_t *encoded, int16_t *decoded)
20
        if (encoded[1] & 0x80)
21
            m_adpcmState[c].previousValue -= 0x10000;
22
 
23
-       m_adpcmState[c].index = encoded[2];
24
+       m_adpcmState[c].index = clamp(encoded[2], 0, 88);
25
 
26
        *decoded++ = m_adpcmState[c].previousValue;
27
 
28
@@ -210,7 +210,7 @@ int IMA::decodeBlockQT(const uint8_t *encoded, int16_t *decoded)
29
            predictor -= 0x10000;
30
 
31
        state.previousValue = clamp(predictor, MIN_INT16, MAX_INT16);
32
-       state.index = encoded[1] & 0x7f;
33
+       state.index = clamp(encoded[1] & 0x7f, 0, 88);
34
        encoded += 2;
35
 
36
        for (int n=0; n<m_framesPerPacket; n+=2)
37
-- 
38
2.11.0
39
​
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.