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

Offset into delay buffer gets corrupted for some builds #4

Open
w23 opened this issue Sep 3, 2019 · 1 comment
Open

Offset into delay buffer gets corrupted for some builds #4

w23 opened this issue Sep 3, 2019 · 1 comment

Comments

@w23
Copy link

w23 commented Sep 3, 2019

For some of the builds 4klang will reliably crash on either this https://github.com/hzdgopher/4klang/blob/e28554120325fcaaebbe8189eef16b57fd83f0a8/4klang_source/4klang.asm#L930 or this https://github.com/hzdgopher/4klang/blob/e28554120325fcaaebbe8189eef16b57fd83f0a8/4klang_source/4klang.asm#L962 lines just 10-20 seconds into synthesized music. eax looks unreasonable.

It seems like go4kDLL_wrk.index value gets corrupted. Not sure where, when and why exactly.
Padding it with 256 bytes (not tried other values really) prevented crashing for at least one of the tunes on a slightly older version of 4klang (doesn't seem to help the latest version from this repo):

struc  go4kDLL_wrk
+       .padding resd 64
        .index          resd    1
+       .padding2 resd 64

The crash may happen on both Windows and Linux for binaries built with their default linkers.
The crash rarely happens if the binary was linked using Crinkler, but everything else was exactly the same.
In rare cases it is possible to randomly tweak e.g. asm/C source of the intro in such a way that a "debug" (not linked using Crinkler) binary won't crash.

Almost all of jetlag 4k intros are affected by this problem :D.

@gopher-atz
Copy link
Owner

Hi Ivan,

could you (or keen) provide me with the respective asm/inc files that reliably crash before you start the padding?

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

No branches or pull requests

2 participants