Merge pull request #3362 from stoeckmann/filter_bits

This commit is contained in:
Dustin L. Howett authored and GitHub committed 2026-08-10 00:53:31 -05:00
commit b100df7e65
2 files changed
+8 -14

No files matched your search

+3 -5
View File
@@ -180,6 +180,7 @@ lz4_reader_bid(struct archive_read_filter_bidder *b,
uint32_t frame_data_size;
/* Skip over the magic number */
bits_checked += 28;
offset_in_buffer += 4;
/* Ensure that we can read another 4 bytes. */
@@ -205,13 +206,11 @@ lz4_reader_bid(struct archive_read_filter_bidder *b,
* if this is LZ4 data.
*/
if (archive_ckd_add_size(&min,
offset_in_buffer, min_lz4_frame_size))
offset_in_buffer, min_lz4_frame_size) ||
min > max_lookahead)
return (0);
/* TODO: should this be >= ? */
if (min > (size_t)avail) {
if (min > max_lookahead)
return (0);
buffer = __archive_read_filter_ahead(f,
min, &avail);
if (buffer == NULL)
@@ -226,7 +225,6 @@ lz4_reader_bid(struct archive_read_filter_bidder *b,
* follows, or this isn't LZ4 data.
*/
bits_checked = offset_in_buffer;
buffer = buffer + offset_in_buffer;
if (magic_number == LZ4_MAGICNUMBER) {
@@ -25,10 +25,6 @@
#include "archive_platform.h"
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
@@ -109,6 +105,7 @@ zstd_bidder_bid(struct archive_read_filter_bidder *b,
{
const unsigned char *buffer;
ssize_t avail;
int bits_checked = 0;
/*
* Zstandard skippable frames contain a 4 byte magic number followed
* by a 4 byte frame data size, then that number of bytes of data.
@@ -147,6 +144,7 @@ zstd_bidder_bid(struct archive_read_filter_bidder *b,
uint32_t frame_data_size;
/* Skip over the magic number */
bits_checked += 28;
offset_in_buffer += 4;
/* Ensure that we can read another 4 bytes. */
@@ -172,12 +170,10 @@ zstd_bidder_bid(struct archive_read_filter_bidder *b,
* if this is zstd data.
*/
if (archive_ckd_add_size(&min,
offset_in_buffer, min_zstd_frame_size))
offset_in_buffer, min_zstd_frame_size) ||
min > max_lookahead)
return (0);
if (min > (size_t)avail) {
if (min > max_lookahead)
return (0);
buffer = __archive_read_filter_ahead(f,
min, &avail);
if (buffer == NULL)
@@ -193,7 +189,7 @@ zstd_bidder_bid(struct archive_read_filter_bidder *b,
*/
if (magic_number == zstd_magic)
return (offset_in_buffer + 4);
return (bits_checked + 32);
return (0);
}