Community
    • Login

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

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    8 Posts 6 Posters 8.0k Views
    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.
    • donhoD
      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++.

      chcgC 1 Reply Last reply Reply Quote 6
      • donhoD donho pinned this topic on
      • donhoD donho referenced this topic on
      • chcgC
        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
        • rdipardoR
          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 VincentM 1 Reply Last reply Reply Quote 2
          • Michael VincentM
            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.

            rdipardoR 1 Reply Last reply Reply Quote 1
            • rdipardoR
              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
              • Michael VincentM Michael Vincent referenced this topic on
              • donhoD donho referenced this topic on
              • donhoD donho referenced this topic on
              • Michael VincentM Michael Vincent referenced this topic on
              • rdipardoR rdipardo referenced this topic on
              • donhoD donho referenced this topic on
              • PeterJonesP PeterJones referenced this topic on
              • Michael VincentM Michael Vincent referenced this topic on
              • Michael VincentM Michael Vincent referenced this topic on
              • rdipardoR
                rdipardo
                last edited by

                A tracking issue has been opened.

                1 Reply Last reply Reply Quote 2
                • donhoD donho referenced this topic on
                • donhoD donho referenced this topic on
                • donhoD donho referenced this topic on
                • Michael VincentM Michael Vincent referenced this topic on
                • Michael VincentM Michael Vincent referenced this topic on
                • Michael VincentM Michael Vincent referenced this topic on
                • rdipardoR rdipardo referenced this topic on
                • rdipardoR rdipardo referenced this topic on
                • rdipardoR rdipardo referenced this topic on
                • Land MarketL
                  Land Market
                  last edited by

                  V8.3.3 ussualy crash, hope v8.4.6 better than

                  1 Reply Last reply Reply Quote 0
                  • Fruchtzwerg94F
                    Fruchtzwerg94
                    last edited by Fruchtzwerg94

                    A few months ago, I’ve created a PR which was already merged to the plugins pack origin repo which targets at least some of the pointers:
                    https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/pull/91
                    And there is still one open:
                    https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/pull/95

                    1 Reply Last reply Reply Quote 1
                    • donhoD donho unpinned this topic on
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors