mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibArchive: Do not assert if the provided stream cannot be discarded
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52498
This commit is contained in:
parent
ee0c9ed87b
commit
e277185eb1
1 changed files with 1 additions and 2 deletions
|
@ -84,12 +84,11 @@ bool TarFileStream::discard_or_error(size_t count)
|
||||||
TarInputStream::TarInputStream(InputStream& stream)
|
TarInputStream::TarInputStream(InputStream& stream)
|
||||||
: m_stream(stream)
|
: m_stream(stream)
|
||||||
{
|
{
|
||||||
if (!m_stream.read_or_error(Bytes(&m_header, sizeof(m_header)))) {
|
if (!m_stream.read_or_error(Bytes(&m_header, sizeof(m_header))) || !m_stream.discard_or_error(block_size - sizeof(TarFileHeader))) {
|
||||||
m_finished = true;
|
m_finished = true;
|
||||||
m_stream.handle_any_error(); // clear out errors so we don't assert
|
m_stream.handle_any_error(); // clear out errors so we don't assert
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VERIFY(m_stream.discard_or_error(block_size - sizeof(TarFileHeader)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr unsigned long block_ceiling(unsigned long offset)
|
static constexpr unsigned long block_ceiling(unsigned long offset)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue