[Github-comments] [geany/geany-plugins] Splitting a snowman in half crashes Geany with Spell Check (inserting a space before Unicode VARIATION SELECTOR-16) (#1041)

Colomban Wendling notifications at xxxxx
Mon Dec 7 13:42:29 UTC 2020


> As I keep saying C++ is not C :grin:

I know, and I battle for avoiding this confusion.  I just see once more that C++ tries to be confusing for C programmers, reproducing syntax but with a whole other lot of constraint that only apply in corner cases :grin: 

Anyhow, a bad patch could be as simple as:
```diff
diff --git a/scintilla/src/Indicator.cxx b/scintilla/src/Indicator.cxx
index f72102772..5c076290b 100644
--- a/scintilla/src/Indicator.cxx
+++ b/scintilla/src/Indicator.cxx
@@ -64,6 +64,8 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
 			const PRectangle rcSquiggle = PixelGridAlign(rc);
 
 			const int width = std::min(4000, static_cast<int>(rcSquiggle.Width()));
+			if (width < 1)
+				break;
 			RGBAImage image(width, 3, 1.0, nullptr);
 			enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f };
 			for (int x = 0; x < width; x++) {
```

It solves the very problem here, but doesn't fix it more generally than just for the squiggles.

Unfortunately just fixing the pixels retrieval is not enough, there's at least one other instance of an empty vector access down the same code path.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/1041#issuecomment-739925758
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20201207/57b1913c/attachment.htm>


More information about the Github-comments mailing list