When sorting CollapsedBorderStyles with qsort, the comparator function (compareBorderStylesForQSort) does not honor the requirement that cmp(a, b) == cmp(b, a). This does not appear for the qsort implementation on the Mac but if you use a bubblesort instead of qsort, the problem appears. The issue is that two borders differ only by color and so compareBorders() returns the first parameter each time it is called. This means that calling compareBorders(a, b) != compareBorders(b, a) and thus compareBorderStylesForQSort(a, b) != compareBorderStylesForQSort(b, a) and so an infinite loop can occur because the sorting algorithm will constantly swap the two values.
Created attachment 13748 [details] Patch to use a stable sort instead. This patch switching border style comparison to use a stable sort instead.
stable_sort will work but it is not the correct solution. A better solution is to fix the comparison function so that a < b => b > a.
It looks to me like this is fixed with http://trac.webkit.org/changeset/67862 (https://bugs.webkit.org/show_bug.cgi?id=39966) as compareBorders() now returns 0 in the case when borders differ only in colour. > if (border1.precedence() == border2.precedence()) > return 0; *** This bug has been marked as a duplicate of bug 39966 ***