From 3d6cdfdaed734159a7fa3d272a3b2ba6f74df4b6 Mon Sep 17 00:00:00 2001 From: Simon Chopin Date: Wed, 21 Aug 2024 10:42:56 +0000 Subject: [PATCH] desauto: initialize the comment array to a sensible value If left uninitialized, the comment array is passed down to client code without being even written to, which means it contains whatever happens to be on the stack whenever the frame for `main` is created. Recent changes to glibc start code have changed said content, and the new one happens to break the test suite when propagated into some temporary files that are then fed to the main leonconv binary. That explains why using ThreadSanitizer "fixes" the test suite: presumably, the runtime initialization code happens to write in that aread of the stack and changes yet again the contents of the comment array, which happens to suit whatever expectations are in leonconv. Fixes #98 --- src/leon/src/desauto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leon/src/desauto.c b/src/leon/src/desauto.c index 13c7a80..d4efae3 100644 --- a/src/leon/src/desauto.c +++ b/src/leon/src/desauto.c @@ -202,7 +202,7 @@ int main( int argc, char *argv[]) char tempArg[8]; enum { DESIGN_AUTO, DESIGN_ISO, MATRIX_AUTO, MATRIX_ISO, CODE_AUTO, CODE_ISO} computationType = DESIGN_AUTO; - char comment[1024]; + char comment[1024] = ""; /* Check whether the first parameters are iso, code, or matrix. Set the computation type. */