aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/delta/delta_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/liblzma/delta/delta_decoder.c')
-rw-r--r--src/liblzma/delta/delta_decoder.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/liblzma/delta/delta_decoder.c b/src/liblzma/delta/delta_decoder.c
index 13d8a28f..77cf65cc 100644
--- a/src/liblzma/delta/delta_decoder.c
+++ b/src/liblzma/delta/delta_decoder.c
@@ -42,7 +42,12 @@ delta_decode(void *coder_ptr, const lzma_allocator *allocator,
in, in_pos, in_size, out, out_pos, out_size,
action);
- decode_buffer(coder, out + out_start, *out_pos - out_start);
+ // out might be NULL. In that case size == 0. Null pointer + 0 is
+ // undefined behavior so skip the call in that case as it would
+ // do nothing anyway.
+ const size_t size = *out_pos - out_start;
+ if (size > 0)
+ decode_buffer(coder, out + out_start, size);
return ret;
}