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`. |
||
---|---|---|
common | ||
contrib | ||
d1x-rebirth | ||
d2x-rebirth | ||
Documentation | ||
similar | ||
.gitignore | ||
COPYING.txt | ||
GPL-3.txt | ||
INSTALL.markdown | ||
SConstruct |