-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix mp3 frames reading to jump correctly to the next bytes #165
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find!
Though, please remove the file, as mentioned in my DM to you ✌️
I think I can create another file to reproduce the same problem, I will try it! |
@linkyndy I replaced the file by other one created by myself! |
I won't be able to review this until after my holiday, so please proceed without me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely. I have some concerns about the offset arithmetic but let's see how the errors / detection rate look like.
@fabioperrella I will take a look at the spec |
closes #163
In MP3Parser, I noticed the logic to jump to the next bytes was wrong (99% sure of that).
To debug it, I added a puts in the method
parse_mpeg_frames
:Then I got this:
The correct would be jumping to 1475, but it jumped +4 because it didn't take into account the 4 bytes that were already read at the beginning of this method:
I fixed to subtract this 4 bytes, like this:
And the result was:
Because of that, it was possible to read the frames correctly!
I also needed to change MAX_FRAMES_TO_SCAN to a greater value, otherwise, it wouldn't reach this point.
Attention!
With this modification, the test
#parse_http is called with hash options
inspec/remote_fetching_spec.rb
started to fail because it started to recognize the filePNG/anim.png
as an mp3 as well!I'm not sure if this behaviour can cause new bugs, wdyt?
Question
This file was authorized by the owner to use as an example. Should I mention his name in somewhere?`(I created a fixture file by myself)