mirror of https://git.tukaani.org/xz.git
liblzma: lzma_str_to_filters: Set *error_pos on all errors
The API docs clearly say that if error_pos isn't NULL then *error is always set on any error. However, it wasn't touched if str == NULL or filters == NULL or unsupported flags were specified. Fixes:cedeeca2ea
(cherry picked from commit70d12dd069
)
This commit is contained in:
parent
6edc2b554f
commit
6364cbc63e
|
@ -996,6 +996,12 @@ extern LZMA_API(const char *)
|
||||||
lzma_str_to_filters(const char *str, int *error_pos, lzma_filter *filters,
|
lzma_str_to_filters(const char *str, int *error_pos, lzma_filter *filters,
|
||||||
uint32_t flags, const lzma_allocator *allocator)
|
uint32_t flags, const lzma_allocator *allocator)
|
||||||
{
|
{
|
||||||
|
// If error_pos isn't NULL, *error_pos must always be set.
|
||||||
|
// liblzma <= 5.4.6 and <= 5.6.1 have a bug and don't do this
|
||||||
|
// when str == NULL or filters == NULL or flags are unsupported.
|
||||||
|
if (error_pos != NULL)
|
||||||
|
*error_pos = 0;
|
||||||
|
|
||||||
if (str == NULL || filters == NULL)
|
if (str == NULL || filters == NULL)
|
||||||
return "Unexpected NULL pointer argument(s) "
|
return "Unexpected NULL pointer argument(s) "
|
||||||
"to lzma_str_to_filters()";
|
"to lzma_str_to_filters()";
|
||||||
|
|
Loading…
Reference in New Issue