serge-rgb / milton

An infinite-canvas paint program
GNU General Public License v3.0
1.53k stars 133 forks source link

Compilation fails because of `stringop-overflow` warning #101

Closed terrybrash closed 5 years ago

terrybrash commented 6 years ago

GCC version: 8.2.0 OS: 64-Bit Linux (Void Linux) Milton version: master (6ab4fd88ae597ffdefc9fc5cb59c968b01a11dd3)

In file included from /home/terry/Downloads/milton/src/unity.cc:9:
/home/terry/Downloads/milton/src/localization.cc: In function 'char* get_localized_string(int)':
/home/terry/Downloads/milton/src/localization.cc:180:24: error: 'char* strncat(char*, const char*, size_t)' specified bound 1 equals source length [-Werror=stringop-overflow=]
                 strncat(with_cmd, "[", 1);
                 ~~~~~~~^~~~~~~~~~~~~~~~~~
/home/terry/Downloads/milton/src/localization.cc:182:24: error: 'char* strncat(char*, const char*, size_t)' specified bound 1 equals source length [-Werror=stringop-overflow=]
                 strncat(with_cmd, "]", 1);
                 ~~~~~~~^~~~~~~~~~~~~~~~~~
/home/terry/Downloads/milton/src/localization.cc:179:24: error: 'char* strncat(char*, const char*, size_t)' specified bound 3 equals source length [-Werror=stringop-overflow=]
                 strncat(with_cmd, spacer, strlen(spacer));
                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/terry/Downloads/milton/src/localization.cc:178:24: error: 'char* strncat(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
                 strncat(with_cmd, name, strlen(name));
                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/terry/Downloads/milton/src/localization.cc:181:24: error: 'char* strncat(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
                 strncat(with_cmd, cmd, strlen(cmd));
                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: error: unrecognized command line option '-Wno-extern-c-compat' [-Werror]
cc1plus: error: unrecognized command line option '-Wno-c++11-compat-deprecated-writable-strings' [-Werror]
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/Milton.dir/build.make:86: CMakeFiles/Milton.dir/src/unity.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:110: CMakeFiles/Milton.dir/all] Error 2
make: *** [Makefile:84: all] Error 2