summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-06-28 14:55:33 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-06-28 14:55:33 (GMT)
commitb9b9e7b46a880e7a628a698fd47173b7f7d68870 (patch)
tree8c1e19dde122daecdf8f4e1ca64bedbfc9ba0093 /Lib
parenteab770404437bd49ebf897b681221784b0035795 (diff)
parent449e2be12b654a9b892648ff5496c6d7dfbb85f9 (diff)
downloadcpython-b9b9e7b46a880e7a628a698fd47173b7f7d68870.zip
cpython-b9b9e7b46a880e7a628a698fd47173b7f7d68870.tar.gz
cpython-b9b9e7b46a880e7a628a698fd47173b7f7d68870.tar.bz2
Issue #24456: Fixed possible buffer over-read in adpcm2lin() and lin2adpcm()
functions of the audioop module.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_audioop.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_audioop.py b/Lib/test/test_audioop.py
index 01ed18d..8f34d72 100644
--- a/Lib/test/test_audioop.py
+++ b/Lib/test/test_audioop.py
@@ -273,6 +273,16 @@ class TestAudioop(unittest.TestCase):
# state must be a tuple or None, not an integer
self.assertRaises(TypeError, audioop.adpcm2lin, b'\0', 1, 555)
self.assertRaises(TypeError, audioop.lin2adpcm, b'\0', 1, 555)
+ # Issues #24456, #24457: index out of range
+ self.assertRaises(ValueError, audioop.adpcm2lin, b'\0', 1, (0, -1))
+ self.assertRaises(ValueError, audioop.adpcm2lin, b'\0', 1, (0, 89))
+ self.assertRaises(ValueError, audioop.lin2adpcm, b'\0', 1, (0, -1))
+ self.assertRaises(ValueError, audioop.lin2adpcm, b'\0', 1, (0, 89))
+ # value out of range
+ self.assertRaises(ValueError, audioop.adpcm2lin, b'\0', 1, (-0x8001, 0))
+ self.assertRaises(ValueError, audioop.adpcm2lin, b'\0', 1, (0x8000, 0))
+ self.assertRaises(ValueError, audioop.lin2adpcm, b'\0', 1, (-0x8001, 0))
+ self.assertRaises(ValueError, audioop.lin2adpcm, b'\0', 1, (0x8000, 0))
def test_lin2alaw(self):
self.assertEqual(audioop.lin2alaw(datas[1], 1),