According to https://bugs.debian.org/976553, mojoshader's build fails on architectures where char is unsigned, such as arm64: the ./lemon parser generator segfaults during the build. I think this is because hash can become negative, causing out-of-bounds access to memory before types[0].
Debian developer Adrian Bunk suggested this one-line patch, which I'll turn into a pull request. (FTBFS is a Debian shorthand for "fails to build from source", because it's such a common class of bug for distributions to have to deal with.)
Description: Fix FTBFS on architectures where char is unsigned
Author: Adrian Bunk <bunk@debian.org>
Bug-Debian: https://bugs.debian.org/976553
--- mojoshader-0.0~hg1314+dfsg.orig/misc/lemon.c
+++ mojoshader-0.0~hg1314+dfsg/misc/lemon.c
@@ -3466,7 +3466,7 @@ void print_stack_union(
int maxdtlength; /* Maximum length of any ".datatype" field. */
char *stddt; /* Standardized name for a datatype */
int i,j; /* Loop counters */
- int hash; /* For hashing the name of a type */
+ unsigned int hash; /* For hashing the name of a type */
const char *name; /* Name of the parser */
/* Allocate and initialize types[] and allocate stddt[] */
This took forever, but I merged the latest Lemon from sqlite. It worked here generally, and it has the unsigned char fix, but let me know if this broke other things.
According to https://bugs.debian.org/976553, mojoshader's build fails on architectures where char is unsigned, such as arm64: the
./lemon
parser generator segfaults during the build. I think this is becausehash
can become negative, causing out-of-bounds access to memory beforetypes[0]
.Debian developer Adrian Bunk suggested this one-line patch, which I'll turn into a pull request. (FTBFS is a Debian shorthand for "fails to build from source", because it's such a common class of bug for distributions to have to deal with.)