Opened 11 years ago

Closed 10 years ago

Last modified 12 months ago

#8983 closed patch

gcc warnings with -DFORTIFY_SOURCE=2 -fstack-protector

Reported by: SF/raorn Owned by: fingolfin
Priority: normal Component: Port: Linux
Keywords: Cc:
Game:

Description

Fix gcc warnings when compiling with -DFORTIFY_SOURCE=2 -fstack-protector.

Some warnings may cause "glibc detected buffer overflow" runtime errors
followed by abort(3).

Ticket imported from: #2684986. Ticket imported from: patches/1088.

Attachments (1)

0002-Fix-gcc-warnings-when-compiling-with-DFORTIFY_SOURC.patch (5.8 KB ) - added by SF/raorn 11 years ago.
gcc-wanings.patch

Download all attachments as: .zip

Change History (10)

by SF/raorn, 11 years ago

gcc-wanings.patch

comment:1 by fingolfin, 11 years ago

Owner: set to fingolfin

comment:2 by fingolfin, 11 years ago

Thanks for your submission. The getcwd & strncat related fixes all make sense.

However, I wonder about the changes to write() calls in backends/midi/seq.cpp and backends/midi/timidity.cpp seem weird. Why would printing a warning if write returns a negative value improve anything? If these were errors, i.e., an "emergency bailout", I'd understand. But either those write failures are "harmless", and can be ignored (in particular, no warning), or they are not, and then they need to be handled.

So we applied the other changes, but I am very reluctant to apply the write() related ones.

comment:3 by fingolfin, 11 years ago

Status: newpending

comment:4 by SF/raorn, 11 years ago

If it's "harmless", then it is possible to so something like:

(void) write(...);

just to STFU the compiler. It's mostly cosmetic changes.

Thanks.

comment:5 by SF/raorn, 11 years ago

Status: pendingnew

comment:6 by sev-, 10 years ago

What is the status of this item?

comment:7 by fingolfin, 10 years ago

In my local git tree I have added the "(void)"s to silence the warnings. It's not yet in the main SVN tree, but will be soon.

comment:8 by fingolfin, 10 years ago

Status: newclosed

comment:9 by digitall, 12 months ago

Component: Port: Linux
Note: See TracTickets for help on using tickets.