icculus / mojoshader

Use Direct3D shaders with other 3D rendering APIs.
https://icculus.org/mojoshader/
zlib License
122 stars 36 forks source link

Fix segfault on architectures where char is unsigned #50

Closed smcv closed 2 years ago

smcv commented 2 years ago

From: Adrian Bunk

On architectures where char is unsigned, such as arm64, a signed hash value can become negative and cause out-of-bounds access before types[0].

Resolves: #49
Bug-Debian: https://bugs.debian.org/976553

smcv commented 2 years ago

cc @AdrianBunk: I hope the commit message I've added matches your understanding of the bug.

flibitijibibo commented 2 years ago

Looks like this was fixed in upstream lemon... 8 years ago!

https://github.com/sqlite/sqlite/commit/01f75f2d68a17d52db2aa7c966e2c687b9e75897

It's probably worth updating from upstream so you get all the fixes at once.

smcv commented 2 years ago

It's probably worth updating from upstream so you get all the fixes at once

Sorry, this is beyond what I can do in a drive-by contribution. If a maintainer wants to do that instead of the minimal change, please go ahead.

flibitijibibo commented 2 years ago

Another motivator to update lemon: Windows also fails with the current revision, it's very likely an update will fix things there as well:

https://github.com/icculus/mojoshader/commit/2215b90a0d509f601c9bd693b54323e38e78a430

flibitijibibo commented 2 years ago

Fixed by https://github.com/icculus/mojoshader/commit/75950e83a51747e3cb3747843861fe7b7d5734d9