Opened 10 years ago

Closed 10 years ago

Last modified 8 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 10 years ago.
gcc-wanings.patch

Download all attachments as: .zip

Change History (10)

Changed 10 years ago by SF/raorn

gcc-wanings.patch

comment:1 Changed 10 years ago by fingolfin

Owner: set to fingolfin

comment:2 Changed 10 years ago by fingolfin

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 Changed 10 years ago by fingolfin

Status: newpending

comment:4 Changed 10 years ago by SF/raorn

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 Changed 10 years ago by SF/raorn

Status: pendingnew

comment:6 Changed 10 years ago by sev-

What is the status of this item?

comment:7 Changed 10 years ago by fingolfin

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 Changed 10 years ago by fingolfin

Status: newclosed

comment:9 Changed 8 months ago by digitall

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