Skip to content

Conversation

Kokan
Copy link
Collaborator

@Kokan Kokan commented Jun 12, 2020

The current stats-freq option could go as high as 2^31-1 (which of course kinda unrealistic), but the opposite happens, the stats reports start to spawn right away in an infinite loop manner.

When timer is adjusted (timespec_add_msec(&timer->expires, freq * 1000);) the freq * 1000 is used, where the freq has the type gint, and the function - correctly - waits a glong, but the multiplication happens before the parameter assignment and in the domain of gint that yields gint overflow.

Kokan added 3 commits June 12, 2020 14:46
The gint freq could hold the value 2^31-1, that later used in the code as:
```
timespec_add_msec(&timer->expires, freq * 1000);
```
While the timespec_add_msec last argument is a glong that could hold 1000*2^31-1,
the multiplication happens in the gint domain, which overflows yielding a
negative number. Causing the timer imidiate trigger.

Signed-off-by: Kokan <[email protected]>
@Kokan Kokan added this to the syslog-ng-3.28 milestone Jun 12, 2020
@Kokan Kokan marked this pull request as ready for review June 12, 2020 13:06
@kira-syslogng
Copy link
Contributor

Build SUCCESS

@lbudai lbudai merged commit 55955c9 into syslog-ng:master Jun 12, 2020
@Kokan Kokan deleted the stats-freq-overflow branch June 12, 2020 18:34
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

Successfully merging this pull request may close these issues.

4 participants