Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codec.SeekingDecoder passes on a broken Reader #15

Closed
jfreymuth opened this issue Sep 9, 2018 · 2 comments · Fixed by #16
Closed

codec.SeekingDecoder passes on a broken Reader #15

jfreymuth opened this issue Sep 9, 2018 · 2 comments · Fixed by #16

Comments

@jfreymuth
Copy link

codec.SeekingDecoder calls a codec's SeekingDecoder function with a *brCloser.
This struct implements io.Reader via a bufio.Reader, but also exposes the Seek method of the underlying Reader, so calls to Read after calls to Seek return wrong data.

Also, a codec's Decoder function is called with a struct that can be type asserted to an io.Seeker, but it's Seek method always panics, which is not technically a bug, but very inconvenient with the way my oggvorbis package works.

@jfreymuth jfreymuth changed the title codec.SeekingDecoder pases on a broken Reader codec.SeekingDecoder passes on a broken Reader Sep 9, 2018
@wsc1
Copy link
Member

wsc1 commented Sep 9, 2018

Thanks for the comments.

I see how being castable to Seeker that only panics can be a problem. will think of a way around it.

For calls to read after seek, yes that's a bug. Note also this comment

which recognises another bug in codec.Codec and proposes to use an interface in its place.

I can get a new codec.Codec in place in the next two days or so. Could you help review the new version?

@wsc1
Copy link
Member

wsc1 commented Sep 10, 2018

This PR I hope will address the issues you brought up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants