Post Reply 
Free42 state file switching, export, and import
08-18-2019, 12:45 PM
Post: #12
RE: Free42 state file switching, export, and import
You are right, Thomas. Each new version of gcc brings new features and checks for common issues that were discovered in the meantime or just considered helpful. Sometimes changes aren't even fully backwards compatible without additional options. Additionally every distribution might define a different set of default options, which makes it even more complicated. I work(ed) with all major versions from 5 to 9 and have seen many unexpected things.

Regarding the warning: An unknown -Wno-* option should not produce an error.

https://gcc.gnu.org/wiki/FAQ#wnowarning Wrote:Since GCC 4.4, and as explained in the GCC manual: when an unrecognized warning option is requested (-Wunknown-warning), GCC emits a diagnostic stating that the option is not recognized. However, if the -Wno- form is used, the behavior is slightly different: no diagnostic is produced for -Wno-unknown-warning unless other diagnostics are being produced. This allows the use of new -Wno- options with old compilers, but if something goes wrong, the compiler warns that an unrecognized option is present.

On the other hand I have no problems with patching your makefile as a package maintainer. But it causes additional work for me and people who want to compile Free42 directly from source.

(08-18-2019 11:37 AM)Thomas Okken Wrote:  
(08-18-2019 09:43 AM)SammysHP Wrote:  4. The buffer for the path generation in gtk/shell_main.cc is too small [...]
You are trying to put two strings with a length of up to 255 characters in a buffer of only 255 characters. There are several places with this issue.

I don't think it's an issue in practice, because who actually uses directories nested that deep and filenames that long that you end up with absolute paths of more than 255 characters? My main reason for using snprintf is that in the unlikely event of such extremely long paths occurring, the code would at least fail gracefully rather than crash.

Here I like to disagree. First, "who actually…" caused a lot of trouble in computer history. Second, you know that this part of the source does not work with valid input in some circumstances, but you ignore it. You don't even check the return value of snprintf(). The code silently fails and (hopefully) an error is produced at different place (when the program tries to read the file). Such long paths are unlikely, but allowed.
In the end this is not a big issue that can cause all kinds of problems (except that loading of the file might fail sometimes), it is just not clean code which could have been avoided.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Free42 state file switching, export, and import - SammysHP - 08-18-2019 12:45 PM



User(s) browsing this thread: 1 Guest(s)