fix(audit): pass 1 — clamp resize-overlay-duration before narrowing to int
resize-overlay-duration is a Duration whose millisecond value (Duration.cval → asMilliseconds, a c_uint) can exceed INT_MAX. The unguarded static_cast<int> would wrap to a negative interval, which QTimer::start() rejects — leaving the resize overlay stuck on screen. Clamp to INT_MAX before the cast. Co-Authored-By: claude-flow <ruv@ruv.net>pull/12846/head
parent
ac5d068040
commit
e6e96c78c4
|
|
@ -11,6 +11,7 @@
|
|||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <limits>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QClipboard>
|
||||
|
|
@ -527,8 +528,14 @@ void GhosttySurface::showResizeOverlay() {
|
|||
// vanished the instant it appeared.
|
||||
unsigned long long durCfgMs = 0;
|
||||
const bool durOk = configGet(cfg, &durCfgMs, "resize-overlay-duration");
|
||||
// Clamp before narrowing: a Duration's millisecond value can exceed
|
||||
// INT_MAX, and a wrapped negative int would make QTimer::start()
|
||||
// reject the interval, leaving the overlay stuck on screen.
|
||||
const int durMs =
|
||||
(durOk && durCfgMs > 0) ? static_cast<int>(durCfgMs) : 750;
|
||||
(durOk && durCfgMs > 0)
|
||||
? static_cast<int>(std::min<unsigned long long>(
|
||||
durCfgMs, std::numeric_limits<int>::max()))
|
||||
: 750;
|
||||
if (!m_resizeHideTimer) {
|
||||
m_resizeHideTimer = new QTimer(this);
|
||||
m_resizeHideTimer->setSingleShot(true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue