Skip to content

Fix restype of CancellableSendMessage#19862

Merged
SaschaCowley merged 1 commit intobetafrom
nppCrash2
Mar 30, 2026
Merged

Fix restype of CancellableSendMessage#19862
SaschaCowley merged 1 commit intobetafrom
nppCrash2

Conversation

@SaschaCowley
Copy link
Copy Markdown
Member

@SaschaCowley SaschaCowley commented Mar 26, 2026

Link to issue number:

May fix #19729

Summary of the issue:

  • as defined in nvdaHelper/local/nvdaHelperLocal.cpp, the return type of cancellableSendMessageTimeout is LRESULT.
  • LRESULT is defined as __int64 on 64-bit Windows, and long on 32-bit Windows. That is, LRESULT is the signed machine-word-sized integer type.
  • However, in source/NVDAHelper/localLib.py, its return type was set to c_int. That is, the signed 32-bit integer type.
  • This may be a contributing factor to NVDA 2026.1 crashes NotePad++ #19729, as ScintillaTextInfo uses cancellableSendMessageTimeout when getting the text offset from point. Since the the return type is signed, very large (but still positive 64-bit two's compliment) integers may be interpreted as negative due to being truncated.
  • On the other hand, if my math is correct, this would only start manifesting in files that are 2GiB or larger, though the reporters did say the files were large.

Description of user facing changes:

Unknown, but may fix a crash in Notepad++ (and potentially other cases)

Description of developer facing changes:

NVDAHelper.localLib.cancellableSendMessageTimeout.restype is now c_longlong

Description of development approach:

Defined LRESULT as c_ssize_t (c_long on 32-bit; c_longlong on 64-bit), and set NVDAHelper.localLib.cancellableSendMessageTimeout's restype to LRESULT.

Testing strategy:

Ran from source and did normal work.
I don't think this has the potential to cause issues, unless we introduced code relying on the incorrect restype during the 64-bit migration, as the return type was fine on 32-bit builds (c_int is c_long).

Known issues with pull request:

None

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@SaschaCowley SaschaCowley marked this pull request as ready for review March 27, 2026 02:25
@SaschaCowley SaschaCowley requested a review from a team as a code owner March 27, 2026 02:25
@SaschaCowley SaschaCowley requested a review from seanbudd March 27, 2026 02:25
@seanbudd
Copy link
Copy Markdown
Member

Should this target beta?

@seanbudd seanbudd added this to the 2026.1 milestone Mar 29, 2026
@SaschaCowley SaschaCowley changed the base branch from master to beta March 30, 2026 00:11
@SaschaCowley
Copy link
Copy Markdown
Member Author

Should this target beta?

Yep, thanks for catching that

@SaschaCowley SaschaCowley merged commit 9446ee0 into beta Mar 30, 2026
43 checks passed
@SaschaCowley SaschaCowley deleted the nppCrash2 branch March 30, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NVDA 2026.1 crashes NotePad++

2 participants