Commit 01ad622a authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #16686: Fixed a lot of bugs in audioop module.

* avgpp() and maxpp() no more crash on empty and 1-samples input fragment. They now work when peak-peak values are greater INT_MAX.
* ratecv() no more crashes on empty input fragment.
* Fixed an integer overflow in ratecv().
* Fixed an integer overflow in add() and bias() for 32-bit samples.
* reverse(), lin2lin() and ratecv() no more lose precision for 32-bit samples.
* max() and rms() no more returns negative result for 32-bit sample -0x80000000.
* minmax() now returns correct max value for 32-bit sample -0x80000000.
* avg(), mul(), tomono() and tostereo() now round negative result down and can return 32-bit sample -0x80000000.
* add() now can return 32-bit sample -0x80000000.
parent a48b61f8
...@@ -36,7 +36,7 @@ The module defines the following variables and functions: ...@@ -36,7 +36,7 @@ The module defines the following variables and functions:
Return a fragment which is the addition of the two samples passed as parameters. Return a fragment which is the addition of the two samples passed as parameters.
*width* is the sample width in bytes, either ``1``, ``2`` or ``4``. Both *width* is the sample width in bytes, either ``1``, ``2`` or ``4``. Both
fragments should have the same length. fragments should have the same length. Samples are truncated in case of overflow.
.. function:: adpcm2lin(adpcmfragment, width, state) .. function:: adpcm2lin(adpcmfragment, width, state)
...@@ -67,7 +67,7 @@ The module defines the following variables and functions: ...@@ -67,7 +67,7 @@ The module defines the following variables and functions:
.. function:: bias(fragment, width, bias) .. function:: bias(fragment, width, bias)
Return a fragment that is the original fragment with a bias added to each Return a fragment that is the original fragment with a bias added to each
sample. sample. Samples wrap around in case of overflow.
.. function:: cross(fragment, width) .. function:: cross(fragment, width)
...@@ -175,7 +175,7 @@ The module defines the following variables and functions: ...@@ -175,7 +175,7 @@ The module defines the following variables and functions:
.. function:: mul(fragment, width, factor) .. function:: mul(fragment, width, factor)
Return a fragment that has all samples in the original fragment multiplied by Return a fragment that has all samples in the original fragment multiplied by
the floating-point value *factor*. Overflow is silently ignored. the floating-point value *factor*. Samples are truncated in case of overflow.
.. function:: ratecv(fragment, width, nchannels, inrate, outrate, state[, weightA[, weightB]]) .. function:: ratecv(fragment, width, nchannels, inrate, outrate, state[, weightA[, weightB]])
......
This diff is collapsed.
...@@ -215,6 +215,12 @@ Core and Builtins ...@@ -215,6 +215,12 @@ Core and Builtins
Library Library
------- -------
- Issue #16686: Fixed a lot of bugs in audioop module. Fixed crashes in
avgpp(), maxpp() and ratecv(). Fixed an integer overflow in add(), bias(),
and ratecv(). reverse(), lin2lin() and ratecv() no more lose precision for
32-bit samples. max() and rms() no more returns a negative result and
various other functions now work correctly with 32-bit sample -0x80000000.
- Issue #17073: Fix some integer overflows in sqlite3 module. - Issue #17073: Fix some integer overflows in sqlite3 module.
- Issue #17114: IDLE now uses non-strict config parser. - Issue #17114: IDLE now uses non-strict config parser.
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment