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

メモリ確保失敗時の挙動について調査する #53

Closed
m-tmatma opened this issue Jun 4, 2018 · 1 comment
Closed

メモリ確保失敗時の挙動について調査する #53

m-tmatma opened this issue Jun 4, 2018 · 1 comment

Comments

@m-tmatma
Copy link
Member

m-tmatma commented Jun 4, 2018

メモリ確保失敗時の挙動について調査する

@berryzplus
Copy link
Contributor

# 結論

落ちます。

通常、 new が失敗すると std::bad_alloc が発生します。
サクラエディタは基本的に例外処理をしていないので
キャッチされない例外ハンドラの実装によりstd::terminateされます。(落ちます。)

一部コードで利用されている new(std::nothrow) が失敗すると戻り値は NULL になります。
サクラエディタは基本的にNULLチェックをしていないので
確保失敗したメモリを参照した時点で Access Violation が発生してプログラムが落ちます。

参考

https://docs.microsoft.com/ja-jp/cpp/cpp/new-operator-cpp?view=vs-2019
https://docs.microsoft.com/ja-jp/cpp/c-runtime-library/reference/set-new-handler?view=vs-2019

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

No branches or pull requests

2 participants