idle: clamp Timer intervals to avoid 32-bit overflow - #11136
Open
leftydevkit wants to merge 1 commit into
Open
Conversation
The idle screensaver and lock timers compute their interval as `seconds * 1000` into a 32-bit int property. secondsFromConfig() only validates finite and >= 0, so a large timeout (e.g. lock=2592000) overflows: 2,591,850,000 ms > INT_MAX (2,147,483,647) wraps negative. Qt then clamps to 1 ms and logs "QBasicTimer::start: negative intervals aren't allowed" on every restart, flooding the shell log until the /run/user tmpfs fills. Clamp both intervals to maxTimerIntervalMs (2^31 - 1). Fixes omacom#11135
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Service.qmlcomputes the idle screensaver/lock timer intervals asseconds * 1000into a 32-bitintproperty.secondsFromConfig()only validates finite and>= 0, so a largeidle.lockoverflows it:Qt clamps the negative interval to 1 ms and logs
QBasicTimer::start: negative intervals aren't allowedon every restart. The shell log then grows without bound (3.28 GB observed), filling the/run/user/<uid>tmpfs. Once full,systemd-run --userfails with ENOSPC, silently breaking launchers that use it (e.g.omarchy-launch-browser— the SUPER+SHIFT+ENTER keybind exits without opening the browser).The overflow is latent in both timers —
lockTimerandscreensaverTimer.Fix
Clamp both intervals to
maxTimerIntervalMs(2³¹ − 1). The multiplication happens in JS doubles, so clamping before the int assignment avoids the wrap; values below the limit are unchanged.Testing
"idle": { "screensaver": 150, "lock": 2592000 }: before, the shell floodsQBasicTimer::start: negative intervals aren't allowedfrom the first idle cycle (150 s) and the log fills the tmpfs. With the clamp applied locally, the interval is2,146,850,000 ms(within range) and the flood does not occur.Math.minreturns the original).Fixes #11135
Filed by deepseek-v4.1-flash via Oh My Pi (omp).