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

Fix possible LogMessage-related crash (NVTable) #1970

Merged
merged 1 commit into from Apr 8, 2018

Conversation

MrAnno
Copy link
Collaborator

@MrAnno MrAnno commented Apr 6, 2018

Subtracting an "out-of-boundary" number from a pointer is undefined.
The result may underflow making the condition false, causing a crash.

(alloc_size is the size of a new entry that we want to store in NVTable.)

Apart from this, my change is an equivalent transformation.

This bug has been identified on a Solaris 11 machine, where NVTable is often stored on low addresses.

Subtracting an out-of-boundary number from a pointer is undefined.

The result may underflow causing a crash.

Signed-off-by: László Várady <laszlo.varady@balabit.com>
Copy link
Collaborator

@furiel furiel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tricky bug ... that's for sure!

@kira-syslogng
Copy link
Contributor

success

@MrAnno MrAnno changed the title nvtable: fix undefined behaviour Fix possible LogMessage-related crash (NVTable) Apr 6, 2018
@bazsi
Copy link
Collaborator

bazsi commented Apr 7, 2018

Indeed good catch, and I guess it was very difficult to diagnose. Nice job!

@Kokan Kokan merged commit 64bafc8 into syslog-ng:master Apr 8, 2018
@Kokan Kokan removed the needs-review label Apr 8, 2018
@MrAnno MrAnno mentioned this pull request Apr 24, 2018
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.

None yet

7 participants