exiv2/tests/bugfixes/github/test_issue_2403.py
Peter 1f364be1fa
Fix seg fault when using iconv_open() (#2403)
* Fix seg fault when using `iconv_open()`

- Fix failure condition for `iconv_open()`
- Add new exception when failing to change the text encoding of an
Exif comment

* Add testing for `iconv_open()` seg fault bug

* Fix Python test by changing log level
2022-11-01 13:33:36 +00:00

26 lines
800 B
Python

# -*- coding: utf-8 -*-
from system_tests import CaseMeta, CopyTmpFiles, check_no_ASAN_UBSAN_errors
@CopyTmpFiles("$data_path/issue_2403_poc.exv")
class checkIconvSegFault(metaclass=CaseMeta):
url = """"""
description = """Test the fixcom action in the exiv2 app"""
filename = """$tmp_path/issue_2403_poc.exv"""
commands = ["""$exiv2 --verbose --log e --encode made_up_encoding fixcom $filename""",
"""$exiv2 --verbose --keep --encode UCS-2LE fixcom $filename"""]
retval = [1,0]
stdout = ["""File 1/1: $filename
""",
"""File 1/1: $filename
Setting Exif UNICODE user comment to "Test"
"""]
stderr = ["""Exiv2 exception in fixcom action for file $filename:
Cannot convert text encoding from 'made_up_encoding' to 'UTF-8'
""",
""""""]