diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2010-10-23 12:30:54 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2010-10-23 12:30:54 +0300 |
commit | 8c947e9291691629714dafb4536c718b6cc24fbd (patch) | |
tree | 3273ec37ac1c88e56ece94297f492da4871695c6 /src/liblzma/common/common.c | |
parent | Windows: Use MinGW's stdio functions. (diff) | |
download | xz-8c947e9291691629714dafb4536c718b6cc24fbd.tar.xz |
liblzma: Make lzma_code() check the reserved members in lzma_stream.
If any of the reserved members in lzma_stream are non-zero
or non-NULL, LZMA_OPTIONS_ERROR is returned. It is possible
that a new feature in the future is indicated by just setting
a reserved member to some other value, so the old liblzma
version need to catch it as an unsupported feature.
Diffstat (limited to 'src/liblzma/common/common.c')
-rw-r--r-- | src/liblzma/common/common.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/liblzma/common/common.c b/src/liblzma/common/common.c index 07b1d476..0408e153 100644 --- a/src/liblzma/common/common.c +++ b/src/liblzma/common/common.c @@ -182,6 +182,20 @@ lzma_code(lzma_stream *strm, lzma_action action) || !strm->internal->supported_actions[action]) return LZMA_PROG_ERROR; + // Check if unsupported members have been set to non-zero or non-NULL, + // which would indicate that some new feature is wanted. + if (strm->reserved_ptr1 != NULL + || strm->reserved_ptr2 != NULL + || strm->reserved_ptr3 != NULL + || strm->reserved_ptr4 != NULL + || strm->reserved_int1 != 0 + || strm->reserved_int2 != 0 + || strm->reserved_int3 != 0 + || strm->reserved_int4 != 0 + || strm->reserved_enum1 != LZMA_RESERVED_ENUM + || strm->reserved_enum2 != LZMA_RESERVED_ENUM) + return LZMA_OPTIONS_ERROR; + switch (strm->internal->sequence) { case ISEQ_RUN: switch (action) { |