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
Diskq: Fix crash when corrupt disk-queue is read (during move) #1924
Conversation
success |
Build SUCCESS, the tests were executed on test branch: master and test suite: functions |
@@ -1852,6 +1852,8 @@ log_msg_lookup_time_stamp_name(const gchar *name) | |||
|
|||
gssize log_msg_get_size(LogMessage *self) | |||
{ | |||
if(!self) return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer an assert here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your reason that a NULL is not a valid LogMessage, but I would not change it.
Using assert would lead an immediate crash which would be unnecessary if we can handle it gracefully.
- There is no valid LogMessage that would be evaluated to 0, therefore a 0 is always an error.
- If we would like to avoid syslog-ng crashes and assert would be preferred then each
log_msg_get_size
call should be guarded. Of course with returning 0 then the user oflog_msg_get_size
should make the error handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for explaining, fine for me
eea735e
to
8b070c1
Compare
Signed-off-by: Gabor Nagy <gabor.nagy@balabit.com>
Signed-off-by: Gabor Nagy <gabor.nagy@balabit.com>
8b070c1
to
7d0a645
Compare
Build SUCCESS, the tests were executed on test branch: master and test suite: functions |
success |
After fixing the restart functionality of disk-queue (see PR #1886) our test cases found another bug in non-reliable disk-queue.
After a successful message pop from disk-queue (either from qout or from overflow buffer or from the disk itself) we call a
move_disk
function to move the messages between the different queues.Order of moving messages:
qout <-- qdisk <-- qoverflow.
In this
move_disk
function there is a lack of error handling when reading from the disk which results in a crash whenlog_msg_get_size
is called with passing a NULL pointer to it.Note that reliable disk-buffer is not affected.
Question:
_move_disk()
is a void function.