Fixed a crash of geany by the git-changebar plugin by changing a glong type to sptr_t in the SCI_ADDTEXT invoking (MinGW64 build) You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany-plugins/pull/1106
-- Commit Summary --
* Fixed a crash of geany by the git-changebar plugin by changing a glong type to sptr_t in the SCI_ADDTEXT invoking (MinGW64 build)
-- File Changes --
M git-changebar/src/gcb-plugin.c (4)
-- Patch Links --
https://github.com/geany/geany-plugins/pull/1106.patch https://github.com/geany/geany-plugins/pull/1106.diff
Hi guys.
I had trouble with the git-changebar plugin, which crashed Geany on SCI_ADDTEXT each time until I changed the glong type casting to sptr_t, like it is used with SCI_ADDTEXT in other places.
I build the geany with MinGW64, so the geany and the scintilla are 64 bit.
Regards, Vlad.
Makes sense, Win64 is the only platform where sizeof(long) != sizeof(ptr) ping @b4n
Tested on Windows, also against a x86_64 build and works.
However, Geany didn't crash on my system without the change. I still consider the change as correct.
@vlvlbel for my curiosity, how do you build Geany? I assume in a Mingw64 shell against "mingw-w64-x86_64-*" packages? I'm wondering why it didn't crash for me.
For completeness, there are a couple of more occurences with the wrong cast: ``` geanylua/glspi_sci.c: if (len) { scintilla_send_message(doc->editor->sci,SCI_COPYTEXT,len,(glong)content); } geanymacro/src/geanymacro.c: scintilla_send_message(sci,me->message,me->wparam,(glong)clipboardcontents); geanymacro/src/geanymacro.c: me->lparam=(glong)(g_strcompress(s[(*k)++])); geanymacro/src/geanymacro.c: me->lparam=(glong)NULL; geanymacro/src/geanymacro.c: me->lparam=(glong)(g_strcompress(s[(*k)++])); geanymacro/src/geanymacro.c: ?((glong) g_strdup((gchar *)(nt->lParam))) : nt->lParam; geanymacro/src/geanymacro.c: me->lparam=(glong)((cTemp!=NULL)?g_strdup(cTemp):g_strdup("")); geanymacro/src/geanymacro.c: me->lparam=(glong)(((*cTemp2)==0)?NULL:g_strdup(cTemp2)); geanynumberedbookmarks/src/geanynumberedbookmarks.c: scintilla_send_message(sci,SCI_MARKERDEFINEPIXMAP,m,(glong)(aszMarkerImages[k])); git-changebar/src/gcb-plugin.c: scintilla_send_message (sci, SCI_ADDTEXT, buf_len, (glong) buf); git-changebar/src/gcb-plugin.c: scintilla_send_message (old_sci, SCI_ADDTEXT, old_buf_len, (glong) old_buf); ``` Should we fix those as well?
how do you build Geany? I assume in a Mingw64 shell against "mingw-w64-x86_64-*" packages? I'm wondering why it didn't crash for me.
@eht16 yeah, I have built Geany from Mingw64 shell against /mingw64/lib and /mingw64/include, i.e against mingw-w64-x86_64 packages. I recently changed my MSYS2 environment, previously it had been x32 MSYS2, now it is x64 MSYS2 fresh installed, so I had to rebuilt my Geany instance. The previous Geany instance was x64 with x32 Scintilla built as DLL (few years ago there were troubles building x64 Scintilla).
For completeness, there are a couple of more occurences with the wrong cast: Should we fix those as well?
I think these occurrences should be fixed as well. The numbered bookmarks plugin crashed for me also, but I just switched it off, and I don't use the Lua plugin and Geanymacro yet. Git-changebar is the only crucial plugin for me in the list above.
how do you build Geany? I assume in a Mingw64 shell against "mingw-w64-x86_64-*" packages? I'm wondering why it didn't crash for me.
@eht16 yeah, I have built Geany from Mingw64 shell against /mingw64/lib and /mingw64/include, i.e against mingw-w64-x86_64 packages. I recently changed my MSYS2 environment, previously it had been x32 MSYS2, now it is x64 MSYS2 fresh installed, so I had to rebuilt my Geany instance. The previous Geany instance was x64 with x32
That might be the difference, I use the same combination as you (Mingw64 shell + /mingw64/lib) but my MSYS2 installation is rather old. Thanks for the information.
For completeness, there are a couple of more occurences with the wrong cast: Should we fix those as well?
I think these occurrences should be fixed as well. The numbered bookmarks plugin crashed for me also, [...]
Agreed, would you mind extending this PR?
Agreed, would you mind extending this PR?
@eht16 yeah, sure, I will do it on Monday.
@vlvlbel pushed 1 commit.
8c1a01ed33b0e0d6651a276835f30cc9a2b54e5b Fixed crashes in Lua, Macro and Numbered Bookmarks plugins under Win64 platform due to a different size of glong and sptr_t
@eht16 I've added the second commit to this pull request.
I've tested Macro and Numbered Plugins- after the changes they began to work for me (before the changes they crashed Geany).
I haven't tested the Lua plugin, but due to a small change there, I believe, it should work.
@vlvlbel thanks! LGTM. I'm going to merge this in a few days, after CI is working again.
Merged #1106 into master.
github-comments@lists.geany.org