From 2c68df96963ecdf7dfd6159ffaabd0629eaca019 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 12 Jan 2026 09:05:40 +0300 Subject: [PATCH] Fixed column bounds check in ShareBox for mouse to prevent cross-rows. Fixed #30155. --- Telegram/SourceFiles/boxes/share_box.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index 2caf3ad3e8..754cf4bd51 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -1313,6 +1313,12 @@ void ShareBox::Inner::updateUpon(const QPoint &pos) { auto x = pos.x(), y = pos.y(); auto row = (y - _rowsTop) / _rowHeight; auto column = qFloor((x - _rowsLeft) / _rowWidthReal); + + if (column < 0 || column >= _columnCount) { + _upon = -1; + return; + } + auto left = _rowsLeft + qFloor(column * _rowWidthReal) + st::shareColumnSkip / 2; auto top = _rowsTop + row * _rowHeight + st::sharePhotoTop; auto xupon = (x >= left) && (x < left + (_rowWidth - st::shareColumnSkip));