mirror of
https://github.com/intel/isa-l.git
synced 2025-02-24 23:34:45 +01:00
igzip: Avoid UB pointer arithmetic underflow for virtual file start
Change-Id: I95c0e6f004eaf70227a6419fc14bf0958d1f4538 Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
parent
139fdb68b9
commit
53b92e83f4
@ -35,7 +35,7 @@ void isal_deflate_body_base(struct isal_zstream *stream)
|
||||
uint64_t code, code_len, code2, code_len2;
|
||||
struct isal_zstate *state = &stream->internal_state;
|
||||
uint16_t *last_seen = state->head;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
uint8_t *file_start = (uint8_t *) ((uintptr_t) stream->next_in - stream->total_in);
|
||||
uint32_t hist_size = state->dist_mask;
|
||||
uint32_t hash_mask = state->hash_mask;
|
||||
|
||||
@ -123,7 +123,7 @@ void isal_deflate_finish_base(struct isal_zstream *stream)
|
||||
uint64_t code, code_len, code2, code_len2;
|
||||
struct isal_zstate *state = &stream->internal_state;
|
||||
uint16_t *last_seen = state->head;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
uint8_t *file_start = (uint8_t *) ((uintptr_t) stream->next_in - stream->total_in);
|
||||
uint32_t hist_size = state->dist_mask;
|
||||
uint32_t hash_mask = state->hash_mask;
|
||||
|
||||
|
@ -44,7 +44,7 @@ void isal_deflate_icf_body_hash_hist_base(struct isal_zstream *stream)
|
||||
struct isal_zstate *state = &stream->internal_state;
|
||||
struct level_buf *level_buf = (struct level_buf *)stream->level_buf;
|
||||
uint16_t *last_seen = level_buf->hash_hist.hash_table;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
uint8_t *file_start = (uint8_t *) ((uintptr_t) stream->next_in - stream->total_in);
|
||||
uint32_t hist_size = state->dist_mask;
|
||||
uint32_t hash_mask = state->hash_mask;
|
||||
|
||||
@ -141,7 +141,7 @@ void isal_deflate_icf_finish_hash_hist_base(struct isal_zstream *stream)
|
||||
struct isal_zstate *state = &stream->internal_state;
|
||||
struct level_buf *level_buf = (struct level_buf *)stream->level_buf;
|
||||
uint16_t *last_seen = level_buf->hash_hist.hash_table;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
uint8_t *file_start = (uint8_t *) ((uintptr_t) stream->next_in - stream->total_in);
|
||||
uint32_t hist_size = state->dist_mask;
|
||||
uint32_t hash_mask = state->hash_mask;
|
||||
|
||||
@ -252,7 +252,7 @@ void isal_deflate_icf_finish_hash_map_base(struct isal_zstream *stream)
|
||||
struct isal_zstate *state = &stream->internal_state;
|
||||
struct level_buf *level_buf = (struct level_buf *)stream->level_buf;
|
||||
uint16_t *last_seen = level_buf->hash_map.hash_table;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
uint8_t *file_start = (uint8_t *) ((uintptr_t) stream->next_in - stream->total_in);
|
||||
uint32_t hist_size = state->dist_mask;
|
||||
uint32_t hash_mask = state->hash_mask;
|
||||
|
||||
|
@ -77,7 +77,7 @@ uint64_t gen_icf_map_h1_base(struct isal_zstream *stream,
|
||||
|
||||
uint32_t dist, len, extra_bits;
|
||||
uint8_t *next_in = stream->next_in, *end_in = stream->next_in + input_size;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
uint8_t *file_start = (uint8_t *) ((uintptr_t) stream->next_in - stream->total_in);
|
||||
uint32_t hash;
|
||||
uint64_t next_bytes, match_bytes;
|
||||
uint64_t match;
|
||||
|
Loading…
x
Reference in New Issue
Block a user