aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/simple/simple_coder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-01-26 00:25:34 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-01-26 00:25:34 +0200
commitf9842f712732c482f2def9f24437851e57dd83f8 (patch)
tree3429da96813e5d0d40d7cf5ee7527c6b35a1acd0 /src/liblzma/simple/simple_coder.c
parentAdded more Multi-Block test files. Improved some (diff)
downloadxz-f9842f712732c482f2def9f24437851e57dd83f8.tar.xz
Return LZMA_HEADER_ERROR if LZMA_SYNC_FLUSH is used with any
of the so called simple filters. If there is demand, limited support for LZMA_SYNC_FLUSH may be added in future. After this commit, using LZMA_SYNC_FLUSH shouldn't cause undefined behavior in any situation.
Diffstat (limited to 'src/liblzma/simple/simple_coder.c')
-rw-r--r--src/liblzma/simple/simple_coder.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/liblzma/simple/simple_coder.c b/src/liblzma/simple/simple_coder.c
index 6ecd119e..e9674308 100644
--- a/src/liblzma/simple/simple_coder.c
+++ b/src/liblzma/simple/simple_coder.c
@@ -101,6 +101,14 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator,
size_t in_size, uint8_t *restrict out,
size_t *restrict out_pos, size_t out_size, lzma_action action)
{
+ // TODO: Add partial support for LZMA_SYNC_FLUSH. We can support it
+ // in cases when the filter is able to filter everything. With most
+ // simple filters it can be done at offset that is a multiple of 2,
+ // 4, or 16. With x86 filter, it needs good luck, and thus cannot
+ // be made to work predictably.
+ if (action == LZMA_SYNC_FLUSH)
+ return LZMA_HEADER_ERROR;
+
// Flush already filtered data from coder->buffer[] to out[].
if (coder->pos < coder->filtered) {
bufcpy(coder->buffer, &coder->pos, coder->filtered,