mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
Add missing error check to coder.c.
With bad luck this could cause a segfault due to reading (but not writing) past the end of the buffer.
This commit is contained in:
parent
bd13b04e20
commit
919fbaff86
1 changed files with 11 additions and 9 deletions
|
@ -617,6 +617,7 @@ coder_run(const char *filename)
|
||||||
strm.next_in = in_buf.u8;
|
strm.next_in = in_buf.u8;
|
||||||
strm.avail_in = io_read(pair, &in_buf, IO_BUFFER_SIZE);
|
strm.avail_in = io_read(pair, &in_buf, IO_BUFFER_SIZE);
|
||||||
|
|
||||||
|
if (strm.avail_in != SIZE_MAX) {
|
||||||
switch (coder_init(pair)) {
|
switch (coder_init(pair)) {
|
||||||
case CODER_INIT_NORMAL:
|
case CODER_INIT_NORMAL:
|
||||||
success = coder_normal(pair);
|
success = coder_normal(pair);
|
||||||
|
@ -629,6 +630,7 @@ coder_run(const char *filename)
|
||||||
case CODER_INIT_ERROR:
|
case CODER_INIT_ERROR:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
message_progress_end(success);
|
message_progress_end(success);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue