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

fuzz testing fails for adj and meshex due to length fields #117

Open
1 of 2 tasks
ScanMountGoat opened this issue Jan 7, 2022 · 2 comments
Open
1 of 2 tasks

fuzz testing fails for adj and meshex due to length fields #117

ScanMountGoat opened this issue Jan 7, 2022 · 2 comments
Labels
bug Something isn't working ssbh_lib reading and writing of ssbh files

Comments

@ScanMountGoat
Copy link
Member

ScanMountGoat commented Jan 7, 2022

Adj and meshex both expose array lengths as fields. The following example fails to read in a write+read+write operation because of the invalid count. The same issue applies to meshex.

Adj {
    entry_count: 4244438268,
    entries: [],
    index_buffer: [
        -772,
        -772,
        -772,
        -772,
        -772,
        -772,
        -772,
    ],
}
  • adj
  • meshex
@ScanMountGoat ScanMountGoat added invalid This doesn't seem right ssbh_lib reading and writing of ssbh files labels Jan 7, 2022
@ScanMountGoat
Copy link
Member Author

ScanMountGoat commented Jan 7, 2022

One solution is to avoid storing the length fields using BinRead's support for temporary variables. SsbhWrite may require an additional attribute to correctly generate the needed field. An easier option that doesn't rely on macro application order is to simply implement SsbhWrite manually to generate the necessary missing fields.

@ScanMountGoat ScanMountGoat changed the title fuzz testing fails for adj and meshex due to entry counts fuzz testing fails for adj and meshex due to length fields Jan 7, 2022
@ScanMountGoat ScanMountGoat added bug Something isn't working and removed invalid This doesn't seem right labels Jan 8, 2022
@ScanMountGoat
Copy link
Member Author

MeshEx tests still fail since the entries and flags can be initialized with a different number of elements. The current implementation returns an error. This could be ignored in the fuzz tests to allow for checking other errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ssbh_lib reading and writing of ssbh files
Projects
None yet
Development

No branches or pull requests

1 participant