Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when lpszFile is a null file, ptr is nullptr and it causes problem #124

Closed
bluenlive opened this issue Jul 22, 2019 · 4 comments

Comments

@bluenlive
Copy link

commented Jul 22, 2019

When lpszFile is a 0 byte file, ptr is nullptr.
So, in following [uint8_t ch = *ptr++;] is while() causes error.

const uint8_t *ptr = (const uint8_t *)SciCall_GetRangePointer(0, headerLen + 1);

@zufuliu

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2019

How to reproduce the crash?
SciCall_GetRangePointer() should never returns NULL unless not initialized.

@bluenlive

This comment has been minimized.

Copy link
Author

commented Jul 22, 2019

If following lines exist in notepad2.ini,
opening 0 size file causes crash.

[Settings]
DefaultEncoding=0

zufuliu added a commit that referenced this issue Jul 22, 2019
@zufuliu

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2019

That's my error on ptr + headerLen which generates the largest pointer.

@bluenlive

This comment has been minimized.

Copy link
Author

commented Jul 22, 2019

Great! Thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.