[Python-checkins] r64775 - in python/trunk: Lib/test/test_audioop.py Modules/audioop.c
facundo.batista
python-checkins at python.org
Mon Jul 7 19:03:00 CEST 2008
Author: facundo.batista
Date: Mon Jul 7 19:02:59 2008
New Revision: 64775
Log:
Issue 3306. Better control for a lenght in findmax() function.
Modified:
python/trunk/Lib/test/test_audioop.py
python/trunk/Modules/audioop.c
Modified: python/trunk/Lib/test/test_audioop.py
==============================================================================
--- python/trunk/Lib/test/test_audioop.py (original)
+++ python/trunk/Lib/test/test_audioop.py Mon Jul 7 19:02:59 2008
@@ -161,6 +161,10 @@
self.assertEqual(audioop.getsample(data[1], 2, i), i)
self.assertEqual(audioop.getsample(data[2], 4, i), i)
+ def test_negavitelen(self):
+ # from issue 3306, previously it segfaulted
+ self.assertRaises(audioop.error,
+ audioop.findmax, ''.join( chr(x) for x in xrange(256)), -2392392)
def test_main():
run_unittest(TestAudioop)
Modified: python/trunk/Modules/audioop.c
==============================================================================
--- python/trunk/Modules/audioop.c (original)
+++ python/trunk/Modules/audioop.c Mon Jul 7 19:02:59 2008
@@ -575,7 +575,7 @@
}
len1 >>= 1;
- if ( len1 < len2 ) {
+ if ( len2 < 0 || len1 < len2 ) {
PyErr_SetString(AudioopError, "Input sample should be longer");
return 0;
}
More information about the Python-checkins
mailing list