This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/19361] New: Invalid comparison functions
- From: "tetra2005 at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sat, 12 Dec 2015 19:25:10 +0000
- Subject: [Bug gdb/19361] New: Invalid comparison functions
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=19361
Bug ID: 19361
Summary: Invalid comparison functions
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: tetra2005 at gmail dot com
Target Milestone: ---
Created attachment 8846
--> https://sourceware.org/bugzilla/attachment.cgi?id=8846&action=edit
Proposed patch
Comparison functions qsort_cmp and compare_processes (used in qsort) do not
obey to standard symmetry requirements which causes undefined behavior. The
latter may result in strange runtime bugs.
Compare_processes fails to properly compare process group leaders which is
probably a serious problem (e.g. resulting in invalid sort).
Qsort_cmp fails to produce proper result when comparing same element. Sane
qsort implementation probably don't call comparison callback on same element so
this may not be a big problem in practice.
I've attached simple patches which correct both errors.
Bugs were found with SortChecker tool (https://github.com/yugr/sortcheck).
--
You are receiving this mail because:
You are on the CC list for the bug.