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
sstables/compressed_file_data_source_impl may segfault if the file is corrupt and EOF is reached prematurely #13599
Comments
bhalevy
added a commit
to bhalevy/scylla
that referenced
this issue
Apr 20, 2023
…ble_exception on premature eof Currently, the reader might dereference a null pointer if the input stream reaches eof prematurely, and read_exactly returns an empty temporary_buffer. Detect this condition before dereferencing the buffer and sstables::malformed_sstable_exception. Fixes scylladb#13599 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
bhalevy
added a commit
to bhalevy/scylla
that referenced
this issue
Apr 20, 2023
…ble_exception on premature eof Currently, the reader might dereference a null pointer if the input stream reaches eof prematurely, and read_exactly returns an empty temporary_buffer. Detect this condition before dereferencing the buffer and sstables::malformed_sstable_exception. Fixes scylladb#13599 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
bhalevy
added a commit
to bhalevy/scylla
that referenced
this issue
May 16, 2023
Reproduces scylladb#13599 and verifies the fix. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
denesb
pushed a commit
that referenced
this issue
Dec 15, 2023
…ble_exception on premature eof Currently, the reader might dereference a null pointer if the input stream reaches eof prematurely, and read_exactly returns an empty temporary_buffer. Detect this condition before dereferencing the buffer and sstables::malformed_sstable_exception. Fixes #13599 Signed-off-by: Benny Halevy <bhalevy@scylladb.com> Closes #13600 (cherry picked from commit 77b70db)
Backported to 5.2. |
denesb
pushed a commit
that referenced
this issue
Dec 15, 2023
…ble_exception on premature eof Currently, the reader might dereference a null pointer if the input stream reaches eof prematurely, and read_exactly returns an empty temporary_buffer. Detect this condition before dereferencing the buffer and sstables::malformed_sstable_exception. Fixes #13599 Signed-off-by: Benny Halevy <bhalevy@scylladb.com> Closes #13600 (cherry picked from commit 77b70db)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In
compressed_file_data_source_impl::get
,read_exactly
might return an empty temporary_buffer if we reach EOF on the uncompressed file prematurely.See
scylladb/sstables/compress.cc
Line 391 in 6ca1b14
If that happens, we may try to dereference a null pointer returned by
buf.get()
inscylladb/sstables/compress.cc
Line 399 in 6ca1b14
Instead, we should throw an exception about the corrupt file.
The text was updated successfully, but these errors were encountered: