[Python-Dev] cpython: Issue #20133: The audioop module now uses Argument Clinic.

Christian Heimes christian at python.org
Sun Jan 26 00:10:40 CET 2014


On 25.01.2014 10:58, serhiy.storchaka wrote:
> http://hg.python.org/cpython/rev/d4099b8a7d0f
> changeset:   88687:d4099b8a7d0f
> user:        Serhiy Storchaka <storchaka at gmail.com>
> date:        Sat Jan 25 11:57:59 2014 +0200
> summary:
>   Issue #20133: The audioop module now uses Argument Clinic.
> 
> files:
>   Modules/audioop.c        |  1077 ++++++++++++++-----------
>   Modules/audioop.clinic.c |   836 ++++++++++++++++++++
>   2 files changed, 1427 insertions(+), 486 deletions(-)
> 

Coverity has detected an issue in this commit:


** CID 1164423:  Division or modulo by zero  (DIVIDE_BY_ZERO)
/Modules/audioop.c: 1375 in audioop_ratecv_impl()


________________________________________________________________________________________________________
*** CID 1164423:  Division or modulo by zero  (DIVIDE_BY_ZERO)
/Modules/audioop.c: 1375 in audioop_ratecv_impl()
1369                without spurious overflow is the challenge; we can
1370                settle for a reasonable upper bound, though, in this
1371                case ceiling(len/inrate) * outrate. */
1372
1373             /* compute ceiling(len/inrate) without overflow */
1374             Py_ssize_t q = len > 0 ? 1 + (len - 1) / inrate : 0;
>>>     CID 1164423:  Division or modulo by zero  (DIVIDE_BY_ZERO)
>>>     In expression "9223372036854775807L / q", division by expression
"q" which may be zero has undefined behavior.
1375             if (outrate > PY_SSIZE_T_MAX / q / bytes_per_frame)
1376                 str = NULL;
1377             else
1378                 str = PyBytes_FromStringAndSize(NULL,
1379                                                 q * outrate *
bytes_per_frame);
1380         }




More information about the Python-Dev mailing list