Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Prevent plugin from crash on v8.3 and later version: Recompile x64 plugins with new header

    Plugin Development
    4
    6
    2651
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • donho
      donho last edited by donho

      Dear all plugin authors,

      You might notice that Notepad++ v8.3 x64 binary will support opening 2GB+ files.

      If your plugins are also released in x64 binary, you should replace Sci_Position.h by the new one (or just replace typedef long Sci_PositionCR; by typedef intptr_t Sci_PositionCR; in Sci_Position.h of your project), then recompile your plugins.

      It can prevent from crash and to have the best compatibility with Notepad++ v8.3 and later versions.

      Feel free to leave your questions/concerning requests here. I will do my best to answer your questions/requests.

      Edit: Once you release a new version, please update nppPluginList with your new release, so users can update the incompatible version of plugins to the new ones directly via their new version of Notepad++.

      chcg 1 Reply Last reply Reply Quote 6
      • Pinned by  donho donho 
      • Referenced by  donho donho 
      • chcg
        chcg @donho last edited by chcg

        @donho Shouldn’t it be at least 8.3 with such a breaking change?

        1 Reply Last reply Reply Quote 6
        • R
          rdipardo last edited by

          @donho, @chcg

          Don’t forget the x64 plugins that target .NET Framework, for example:

          • CS-Script
          • CsvQuery
          • JSFunctionViewer
          • Markdown Panel
          • MarkdownViewer++
          • NppGist
          • WakaTime

          These are based on a .NET plugin template that re-implements the Scintilla interface in C#.

          Looking at the template code, it seems character ranges are defined using the int type:

            [StructLayout(LayoutKind.Sequential)]
            public struct CharacterRange
            {
                public CharacterRange(int cpmin, int cpmax) { cpMin = cpmin; cpMax = cpmax; }
                public int cpMin;
                public int cpMax;
            }
          

          That will surely overflow as int is an alias for the Common Language Runtime’s Int32 type.

          Michael Vincent 1 Reply Last reply Reply Quote 2
          • Michael Vincent
            Michael Vincent @rdipardo last edited by

            @rdipardo said in Recompile your x64 plugins with new header:

            Don’t forget the x64 plugins that target .NET Framework, for example:

            Good point and I’ve looked at some. I think (correct me if I’m wrong) the crash only manifests if you actually use a Scintilla call that would return a Sci_TextRange object and looking on Scintilla Docs, there seem to be only 2:

            • SCI_GETTEXTRANGE
            • SCI_GETSTYLEDTEXT

            I checked my version of Markdown Panel and although the “bad” Scintilla interface code is there, the plugin never uses / calls it and in my daily use of Notepad++ (using the latest dev build) Markdown Panel has not crashed for me.

            On the other hand, CsvQuery does crash Notepad++ and it does indeed make a getTextRange() call here and here. An issue has been opened.

            I can’t speak for the rest as I don’t use them nor do I know C# programming in the least.

            Cheers.

            R 1 Reply Last reply Reply Quote 1
            • R
              rdipardo @Michael Vincent last edited by rdipardo

              CS-Script is confirmed vulnerable. Haven’t tried the others yet.

              I’ve taken the issue upstream, but even if NppPlugin.NET gets patched (a new version has been in pre-release for over a year), there’s no telling when/if the dependent plugins will upgrade. (At least the migration path looks easy enough.)

              1 Reply Last reply Reply Quote 1
              • Referenced by  Michael Vincent Michael Vincent 
              • Referenced by  donho donho 
              • Referenced by  donho donho 
              • Referenced by  Michael Vincent Michael Vincent 
              • Referenced by  R rdipardo 
              • Referenced by  donho donho 
              • Referenced by  PeterJones PeterJones 
              • Referenced by  Michael Vincent Michael Vincent 
              • Referenced by  Michael Vincent Michael Vincent 
              • R
                rdipardo last edited by

                A tracking issue has been opened.

                1 Reply Last reply Reply Quote 2
                • Referenced by  donho donho 
                • Referenced by  donho donho 
                • Referenced by  donho donho 
                • Referenced by  Michael Vincent Michael Vincent 
                • Referenced by  Michael Vincent Michael Vincent 
                • Referenced by  Michael Vincent Michael Vincent 
                • Referenced by  R rdipardo 
                • Referenced by  R rdipardo 
                • Referenced by  R rdipardo 
                • First post
                  Last post
                Copyright © 2014 NodeBB Forums | Contributors