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

Fix: VAB parsing 1 too many instruments #283

Merged
merged 5 commits into from
Jan 27, 2022
Merged

Conversation

Meerkov
Copy link
Contributor

@Meerkov Meerkov commented Jan 22, 2022

Edit: I changed this from a nit, to an actual bug fix.

Technically this can overflow. I'm not sure if it has practical effects, but this fixes it.
The previous example would parse N+1 instruments, when only N exist.
@Meerkov Meerkov changed the title Fix overflow in VAB Fix: VAB parsing 1 too many instruments Jan 22, 2022
@Meerkov
Copy link
Contributor Author

Meerkov commented Jan 22, 2022

Please take a look. When the number of instruments was 1, the code would parse first the 0 offset, then the 1 offset. But instrument 1 doesn't exist.

This probably wouldn't cause too many problems, but if there was 512 instruments used, this would seemingly start doing some wacky things.

Copy link
Member

@loveemu loveemu left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! The original code was strange and confusing to me, and I think your changes are reasonable. I made a few suggestions, albeit trivial ones.

src/main/formats/Vab.cpp Outdated Show resolved Hide resolved
src/main/formats/Vab.cpp Outdated Show resolved Hide resolved
src/main/formats/Vab.cpp Outdated Show resolved Hide resolved
src/main/formats/Vab.cpp Outdated Show resolved Hide resolved
src/main/formats/Vab.cpp Outdated Show resolved Hide resolved
src/main/formats/Vab.cpp Outdated Show resolved Hide resolved
Meerkov and others added 2 commits January 26, 2022 17:18
Co-authored-by: loveemu <loveemu@gmail.com>
Co-authored-by: loveemu <loveemu@gmail.com>
@loveemu
Copy link
Member

loveemu commented Jan 27, 2022

@sykhro I have approved the pull request. There are several merge strategies to choose from, do you have any recommendations?

@sykhro
Copy link
Member

sykhro commented Jan 27, 2022

I'm okay with anything but squashing. Perhaps we can go for rebase & merge, up to you. Whatever we end up choosing it should probably become the default from now on

@loveemu loveemu merged commit 55393d9 into vgmtrans:master Jan 27, 2022
mikelow pushed a commit that referenced this pull request Jul 16, 2023
Fix: VAB parsing 1 too many instruments
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 this pull request may close these issues.

None yet

3 participants