Skip to content

[3.6] Add check for channels of wav file in Lib/wave.py - #4437

Closed
BT123 wants to merge 1 commit into
python:masterfrom
BT123:test-pr
Closed

BT123 wants to merge 1 commit into
python:masterfrom
BT123:test-pr

Conversation

@BT123

@BT123 BT123 commented Nov 17, 2017

Copy link
Copy Markdown

I found a bug in wave.py because there is no check for self._channel in fmt reading function.
When I try to open a wav file which channel is zero, it will crash bacause of divided by zero in initfp function.

@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

Comment thread Lib/wave.py
self._sampwidth = (sampwidth + 7) // 8
else:
raise Error('unknown format: %r' % (wFormatTag,))
if self._channels == 0:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken, then this attribute was called _nchannels in previous versions of Python, i.e. 3.4.x. It might be a good idea to use the getnchannels() method to access this information instead, which abstracts the concrete name. This has the advantage of making this patch applicable to previous versions of Python, too.

@ned-deily

Copy link
Copy Markdown
Member

This PR has been superseded by the discussion in bpo-32056 where it was decided to not try to address this a bug in 3.6.

@ned-deily ned-deily closed this Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants