cpython: ce89dcba008f (original) (raw)

--- a/Lib/test/test_audioop.py +++ b/Lib/test/test_audioop.py @@ -21,9 +21,9 @@ def gendata4(): data = [gendata1(), gendata2(), gendata4()] INVALID_DATA = [

] @@ -94,7 +94,9 @@ class TestAudioop(unittest.TestCase): def test_adpcm2lin(self): # Very cursory test

def test_lin2adpcm(self): # Very cursory test @@ -109,6 +111,9 @@ class TestAudioop(unittest.TestCase): # Cursory d = audioop.lin2alaw(data[0], 1) self.assertEqual(audioop.alaw2lin(d, 1), data[0])

def test_lin2ulaw(self): self.assertEqual(audioop.lin2ulaw(data[0], 1), b'\xff\xe7\xdb') @@ -119,6 +124,9 @@ class TestAudioop(unittest.TestCase): # Cursory d = audioop.lin2ulaw(data[0], 1) self.assertEqual(audioop.ulaw2lin(d, 1), data[0])

def test_mul(self): data2 = [] @@ -195,10 +203,15 @@ class TestAudioop(unittest.TestCase): self.assertRaises(audioop.error, audioop.lin2lin, data, size, size2) self.assertRaises(audioop.error, audioop.ratecv, data, size, 1, 1, 1, state) self.assertRaises(audioop.error, audioop.lin2ulaw, data, size)

+

def test_main():

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,9 @@ Core and Builtins Library ------- +- Issue #13806: The size check in audioop decompression functions was too

--- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -1311,7 +1311,7 @@ audioop_ulaw2lin(PyObject *self, PyObjec &cp, &len, &size) ) return 0;

if (len > PY_SSIZE_T_MAX/size) { @@ -1380,7 +1380,7 @@ audioop_alaw2lin(PyObject *self, PyObjec &cp, &len, &size) ) return 0;

if (len > PY_SSIZE_T_MAX/size) { @@ -1524,7 +1524,7 @@ audioop_adpcm2lin(PyObject *self, PyObje &cp, &len, &size, &state) ) return 0;

/* Decode state, should have (value, step) */