Skip to content

Commit

Permalink
update mupdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Kowalczyk committed Nov 22, 2023
1 parent ba4010a commit ad9469c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions mupdf/source/fitz/lzxd.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ drop_block(fz_context *ctx, block_t *block)
case kind_alignedoffset:
drop_tree(ctx, block->kind.u.aligned_offset.main_tree);
drop_tree(ctx, block->kind.u.aligned_offset.length_tree);
drop_tree(ctx, block->kind.u.aligned_offset.aligned_offset_tree);
break;
case kind_uncompressed:
break;
Expand Down
14 changes: 9 additions & 5 deletions mupdf/source/fitz/unchm.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ next_chm(fz_context *ctx, fz_stream *stm, size_t required)
fz_throw(ctx, FZ_ERROR_GENERIC, "Short read in CHM handling");
stm->pos += n;
stm->rp = state->buffer;
stm->wp = stm->wp + left;
stm->wp = stm->rp + left;
return *stm->rp++;
}

Expand Down Expand Up @@ -339,17 +339,18 @@ get_encint(fz_context *ctx, fz_stream *stm, uint32_t *left)
{
uint32_t v = 0;
uint32_t w;
int n = 4;
int res, n = 4;

do
{
if (n-- == 0 || *left == 0)
fz_throw(ctx, FZ_ERROR_GENERIC, "Overly long encoded int in CHM");

(*left) -= 1;
w = fz_read_byte(ctx, stm);
if (w == EOF)
res = fz_read_byte(ctx, stm);
if (res == EOF)
fz_throw(ctx, FZ_ERROR_GENERIC, "EOF in encoded int in CHM");
w = res;
v = (v<<7) | (w & 127);
}
while (w & 128);
Expand Down Expand Up @@ -395,7 +396,10 @@ read_listing_chunk(fz_context *ctx, fz_chm_archive *chm, uint32_t dir_chunk_size
n = fz_read(ctx, stm, (uint8_t *)name, namelen);
if (n < namelen)
fz_throw(ctx, FZ_ERROR_GENERIC, "Truncated name in CHM");
name[namelen] = 0;
if (namelen > 1 && name[namelen - 1] == '/')
name[namelen - 1] = 0;
else
name[namelen] = 0;
left -= namelen;
sec = get_encint(ctx, stm, &left);
off = get_encint(ctx, stm, &left);
Expand Down
2 changes: 1 addition & 1 deletion mupdf/source/html/html-layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ static void layout_table(fz_context *ctx, layout_data *ld, fz_html_box *box, fz_
{
squish_block(ctx, row);
continue; /* still skipping */
}
}
}

layout_table_row(ctx, ld, row, ncol, colw, spacing);
Expand Down
6 changes: 3 additions & 3 deletions mupdf/source/pdf/pdf-clean-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ static void pdf_rearrange_pages_imp(fz_context *ctx, pdf_document *doc, int coun
fz_catch(ctx)
{
fz_rethrow(ctx);
}
}
}

void pdf_rearrange_pages(fz_context *ctx, pdf_document *doc, int count, int *new_page_list)
Expand Down Expand Up @@ -469,10 +469,10 @@ void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password

if (spage < epage)
for (page = spage; page <= epage; ++page)
pages[len++] = page;
pages[len++] = page - 1;
else
for (page = spage; page >= epage; --page)
pages[len++] = page;
pages[len++] = page - 1;
}

argidx++;
Expand Down
2 changes: 1 addition & 1 deletion mupdf/source/pdf/pdf-colorspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pdf_load_colorspace_imp(fz_context *ctx, pdf_obj *obj, pdf_cycle_list *cycle_up)
pdf_cycle_list cycle;

if (pdf_cycle(ctx, &cycle, cycle_up, obj))
fz_throw(ctx, FZ_ERROR_SYNTAX, "recursive colorspace");
fz_throw(ctx, FZ_ERROR_SYNTAX, "recursive colorspace");

if (pdf_is_name(ctx, obj))
{
Expand Down

0 comments on commit ad9469c

Please sign in to comment.