dail8859 / LuaScript

Notepad++ plugin for Lua scripting capabilities

Home Page:https://dail8859.github.io/LuaScript/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autocomplete crashes 64-bit N++ since 8.3

rdipardo opened this issue · comments

Typing a . into the LuaScript console will crash 64-bit versions of N++ 8.3.1 (and 8.3).
It's caused by the autocomplete function instantiating a Sci_TextToFind struct with Sci_PositionCR fields typed as long:

static std::string getLuaIdentifierAt(GUI::ScintillaWindow *sw, int pos) {
const int line = sw->Call(SCI_LINEFROMPOSITION);
Sci_TextToFind ttf = {
{
// Search backwards
pos,
sw->Call(SCI_POSITIONFROMLINE, line)
},
"[a-z_][a-z0-9_]*(\\.[a-z_][a-z0-9_]*)*",
};
// Only return the range if it ends at pos
if (sw->CallPointer(SCI_FINDTEXT, SCFIND_REGEXP, &ttf) != -1 && ttf.chrgText.cpMax == pos)
return getRange(sw, ttf.chrgText.cpMin, ttf.chrgText.cpMax);
else
return std::string();
}

x64 builds of N++ now return 64-bit character range fields from all APIs that receive a pointer to a Sci_TextToFind or Sci_TextRange struct. Calling SCI_FINDTEXT in this context ends with a fatal exception:

debug_crash

To reproduce:

  1. Install 64-bit LuaSsript (0.11) and click "Show Console"
  2. Begin typing npp at the prompt

console

  1. Try to type .
  2. The editor crashes
Notepad++ v8.3.1   (64-bit)
Build time : Feb 13 2022 - 15:41:12
Path : C:\Users\Rob\git\bin\npp_8.3.1\notepad++.exe
Command Line : 
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
OS Name : Windows 11 (64-bit) 
OS Version : 2009
OS Build : 22000.527
Current ANSI codepage : 65001
Plugins : LuaScript.dll mimeTools.dll NppConverter.dll NppExport.dll 

Thanks for the report.

Hi. Not sure if it'll be known at this point, but I'm also getting a crash as soon as I press Enter key or the "Run" button (Windows 10 Pro 64-bit, N++ 8.3.2 Portable by PortableApps.com).