aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-08-25 18:14:50 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-08-25 18:14:50 +0000
commit593847a0e063522bef780ebac4f4072cf4cae6d8 (patch)
treea03ce9f42e025dd681cd2236cd8cffdb303c64cc /src
parent0da41dbf5bdf9614a3d2f1d3ebd959221bbac44b (diff)
fix overflow in qsort compare proc
git-svn-id: http://skia.googlecode.com/svn/trunk@335 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkScan_Path.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index 211259fcf7..636478dc3a 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -383,7 +383,11 @@ extern "C" {
valuea = edgea->fX;
valueb = edgeb->fX;
}
- return valuea - valueb;
+
+ // this overflows if valuea >>> valueb or vice-versa
+ // return valuea - valueb;
+ // do perform the slower but safe compares
+ return (valuea < valueb) ? -1 : (valuea > valueb);
}
}