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

#1914 で確認した問題への対策を追加 #1966

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
CRuler::DrawRulerBg メソッドで nMaxLineKetas (10240) より keta の値が大きくなる為に結果的…
…に負の値が size_t 型のローカル変数に代入され、極端に大きい値が std::vector::resize メソッドに渡されてしまう問題への対策を追加 
  • Loading branch information
beru committed Jul 15, 2024
commit c1fafbe9e4e14506cde2bca6049c44fd00aba673
2 changes: 1 addition & 1 deletion sakura_core/view/CRuler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void CRuler::DrawRulerBg(CGraphics& gr)

// 目盛り線を1本ずつ描画するのではなく後述する PolyPolyline でまとめて描画を行う
const int nWidth = (Int)(m_pEditView->GetTextArea().GetRightCol() - i);
const size_t nLinesToDraw = 1 + std::min<int>((nWidth + 1 + 1 + oneColumn - 1) / oneColumn, nMaxLineKetas - keta + 1);
const size_t nLinesToDraw = 1 + std::min<int>((nWidth + 1 + 1 + oneColumn - 1) / oneColumn, std::max(nMaxLineKetas - keta, 0) + 1);
auto& apt = m_apt;
auto& asz = m_asz;
apt.resize(nLinesToDraw * 2);
Expand Down