• Login
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.8k 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.
  • D
    donho
    last edited by donho Apr 18, 2022, 3:03 PM Feb 1, 2022, 1:21 AM

    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++.

    C 1 Reply Last reply Feb 1, 2022, 6:38 AM Reply Quote 6
    • D donho pinned this topic on Feb 1, 2022, 1:22 AM
    • D donho referenced this topic on Feb 1, 2022, 1:51 AM
    • C
      chcg @donho
      last edited by chcg Feb 1, 2022, 6:39 AM Feb 1, 2022, 6:38 AM

      @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 Feb 1, 2022, 7:46 AM

        @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 .

        M 1 Reply Last reply Feb 1, 2022, 12:31 PM Reply Quote 2
        • M
          Michael Vincent @rdipardo
          last edited by Feb 1, 2022, 12:31 PM

          @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 Feb 1, 2022, 1:32 PM Reply Quote 1
          • R
            rdipardo @Michael Vincent
            last edited by rdipardo Feb 1, 2022, 1:34 PM Feb 1, 2022, 1:32 PM

            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
            • M Michael Vincent referenced this topic on Feb 1, 2022, 1:52 PM
            • D donho referenced this topic on Feb 3, 2022, 11:07 PM
            • D donho referenced this topic on Feb 4, 2022, 3:18 AM
            • M Michael Vincent referenced this topic on Feb 4, 2022, 10:01 PM
            • R rdipardo referenced this topic on Feb 5, 2022, 11:16 PM
            • D donho referenced this topic on Feb 7, 2022, 7:50 PM
            • P PeterJones referenced this topic on Feb 7, 2022, 9:20 PM
            • M Michael Vincent referenced this topic on Feb 7, 2022, 10:19 PM
            • M Michael Vincent referenced this topic on Feb 7, 2022, 10:20 PM
            • R
              rdipardo
              last edited by Feb 13, 2022, 2:25 AM

              A tracking issue has been opened.

              1 Reply Last reply Reply Quote 2
              • D donho referenced this topic on Feb 15, 2022, 4:17 PM
              • D donho referenced this topic on Feb 27, 2022, 3:43 PM
              • D donho referenced this topic on Feb 27, 2022, 3:58 PM
              • M Michael Vincent referenced this topic on Feb 27, 2022, 4:35 PM
              • M Michael Vincent referenced this topic on Mar 2, 2022, 6:22 PM
              • M Michael Vincent referenced this topic on Mar 2, 2022, 6:23 PM
              • R rdipardo referenced this topic on Mar 10, 2022, 12:31 PM
              • R rdipardo referenced this topic on Mar 27, 2022, 8:53 PM
              • R rdipardo referenced this topic on May 5, 2022, 2:37 AM
              • L
                Land Market
                last edited by Nov 10, 2022, 1:08 AM

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

                1 Reply Last reply Reply Quote 0
                • F
                  Fruchtzwerg94
                  last edited by Fruchtzwerg94 Nov 10, 2022, 9:10 PM Nov 10, 2022, 9:09 PM

                  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
                  • D donho unpinned this topic on Aug 15, 2023, 12:19 AM
                  4 out of 8
                  • First post
                    4/8
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors