openbsd-ports/textproc/xpdf/patches/patch-splash_SplashXPath_cc
2011-10-01 19:46:35 +00:00

33 lines
1.2 KiB
Plaintext

$OpenBSD: patch-splash_SplashXPath_cc,v 1.3 2011/10/01 19:46:35 kili Exp $
--- splash/SplashXPath.cc.orig Mon Aug 15 23:08:53 2011
+++ splash/SplashXPath.cc Thu Aug 18 21:10:22 2011
@@ -73,10 +73,26 @@ SplashXPath::SplashXPath(SplashPath *path, SplashCoord
sizeof(SplashXPathAdjust));
for (i = 0; i < path->hintsLength; ++i) {
hint = &path->hints[i];
+ if (hint->firstPt >= path->length || hint->lastPt >= path->length) {
+ path->hintsLength = i;
+ if (i == 0) {
+ gfree(adjusts);
+ adjusts = NULL;
+ }
+ break;
+ }
x0 = pts[hint->ctrl0 ].x; y0 = pts[hint->ctrl0 ].y;
- x1 = pts[hint->ctrl0 + 1].x; y1 = pts[hint->ctrl0 + 1].y;
+ if (hint->ctrl0 + 1 >= path->length) {
+ x1 = x0; y1 = y0;
+ } else {
+ x1 = pts[hint->ctrl0 + 1].x; y1 = pts[hint->ctrl0 + 1].y;
+ }
x2 = pts[hint->ctrl1 ].x; y2 = pts[hint->ctrl1 ].y;
- x3 = pts[hint->ctrl1 + 1].x; y3 = pts[hint->ctrl1 + 1].y;
+ if (hint->ctrl1 + 1 >= path->length) {
+ x3 = x2; y3 = y2;
+ } else {
+ x3 = pts[hint->ctrl1 + 1].x; y3 = pts[hint->ctrl1 + 1].y;
+ }
if (x0 == x1 && x2 == x3) {
adjusts[i].vert = gTrue;
adj0 = x0;