Go to file
Kp 0fd80b12df Prevent out-of-bounds read when sorting segment sides
GCC 6 `std::sort` sometimes compares an element to itself.  For a normal
implementation of comparison, this is useless, but not harmful.  The
render comparison predicate relies on accessing A[B[a][b]] when
comparing `a` and `b`.  Array `B` has `-1` in positions where `a == b`,
which causes an access to `A[-1]`, which is undefined behavior.  This
crashes when using _GLIBCXX_DEBUG:

    Error: attempt to subscript container with out-of-bounds index -1, but
    container only holds 8 elements.

    Objects involved in the operation:
	sequence "this" @ 0x0x335adf0 {
	  type = std::__debug::array<int, 8ul>::_Array_check_subscript<8ul>;
	}

Since this is undefined behavior, non-debug builds might also misbehave.
Current data layouts make it likely that the failure would not have
externally observable consequences.

Prevent the invalid access by short-circuiting the result if `a == b`.
2017-02-11 21:42:43 +00:00
common Relax valptridx<T>::guarded compile-time checks 2017-02-11 21:42:43 +00:00
contrib Update Xcode project for recently added/removed files 2017-01-07 15:30:18 +08:00
d1x-rebirth Simplify redundant ehostage.cpp conditional 2017-02-08 23:34:41 +00:00
d2x-rebirth Pass canvas to LINE_SPACING 2017-02-11 21:42:42 +00:00
Documentation Require support for reference qualified methods 2016-12-10 17:51:07 +00:00
similar Prevent out-of-bounds read when sorting segment sides 2017-02-11 21:42:43 +00:00
.gitignore ignore XCode user data 2014-12-06 22:43:12 -08:00
COPYING.txt corrected typo in COPYING.txt (it's to its) 2014-06-06 13:18:52 +02:00
GPL-3.txt
INSTALL.markdown Fix Ubuntu package name in INSTALL.markdown 2016-12-23 02:56:55 +00:00
SConstruct Tighten test for warning -Wuseless-cast 2017-02-08 23:34:41 +00:00