VirusTotal / yara-python

The Python interface for YARA
http://virustotal.github.io/yara/
Apache License 2.0
637 stars 178 forks source link

TestYara::testStringIO segfaults with python-3.12 #237

Closed mikelolasagasti closed 10 months ago

mikelolasagasti commented 11 months ago

Issue detected by Fedora's continuous building system Koschei.

https://koschei.fedoraproject.org/package/python-yara?collection=f39

+ cd yara-python-4.3.1
+ CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64   -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer '
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes '
+ PATH=/builddir/build/BUILDROOT/python-yara-4.3.1-1.fc39.x86_64/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
+ PYTHONPATH=/builddir/build/BUILDROOT/python-yara-4.3.1-1.fc39.x86_64/usr/lib64/python3.12/site-packages:/builddir/build/BUILDROOT/python-yara-4.3.1-1.fc39.x86_64/usr/lib/python3.12/site-packages
+ PYTHONDONTWRITEBYTECODE=1
+ PYTEST_XDIST_AUTO_NUM_WORKERS=6
+ /usr/bin/pytest -k '' tests.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.0b4, pytest-7.3.2, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /builddir/build/BUILD/yara-python-4.3.1
collecting ... collected 47 items
tests.py::TestYara::testAnonymousStrings PASSED                          [  2%]
tests.py::TestYara::testArithmeticOperators PASSED                       [  4%]
tests.py::TestYara::testAt PASSED                                        [  6%]
tests.py::TestYara::testBitwiseOperators PASSED                          [  8%]
tests.py::TestYara::testBooleanOperators PASSED                          [ 10%]
tests.py::TestYara::testCallback PASSED                                  [ 12%]
tests.py::TestYara::testCallbackAll PASSED                               [ 14%]
tests.py::TestYara::testComments PASSED                                  [ 17%]
tests.py::TestYara::testCompare PASSED                                   [ 19%]
tests.py::TestYara::testComparisonOperators PASSED                       [ 21%]
tests.py::TestYara::testCompileFile PASSED                               [ 23%]
tests.py::TestYara::testCompileFiles PASSED                              [ 25%]
tests.py::TestYara::testCompilerErrorOnWarning PASSED                    [ 27%]
tests.py::TestYara::testConsoleCallback PASSED                           [ 29%]
tests.py::TestYara::testCount PASSED                                     [ 31%]
tests.py::TestYara::testDuplicateMeta PASSED                             [ 34%]
tests.py::TestYara::testEntrypoint PASSED                                [ 36%]
tests.py::TestYara::testExternals PASSED                                 [ 38%]
tests.py::TestYara::testFilesize PASSED                                  [ 40%]
tests.py::TestYara::testFor PASSED                                       [ 42%]
tests.py::TestYara::testGlobalPrivate PASSED                             [ 44%]
tests.py::TestYara::testHexStrings PASSED                                [ 46%]
tests.py::TestYara::testIn PASSED                                        [ 48%]
tests.py::TestYara::testIncludeCallback PASSED                           [ 51%]
tests.py::TestYara::testIncludeFiles PASSED                              [ 53%]
tests.py::TestYara::testIntegerFunctions PASSED                          [ 55%]
tests.py::TestYara::testLength PASSED                                    [ 57%]
tests.py::TestYara::testMatchMemoryview PASSED                           [ 59%]
tests.py::TestYara::testMatchedLength PASSED                             [ 61%]
tests.py::TestYara::testMeta PASSED                                      [ 63%]
tests.py::TestYara::testMetaNull PASSED                                  [ 65%]
tests.py::TestYara::testModuleData PASSED                                [ 68%]
tests.py::TestYara::testModules PASSED                                   [ 70%]
tests.py::TestYara::testOf PASSED                                        [ 72%]
tests.py::TestYara::testOffset PASSED                                    [ 74%]
tests.py::TestYara::testRE PASSED                                        [ 76%]
tests.py::TestYara::testRulesIterator PASSED                             [ 78%]
tests.py::TestYara::testScanMeta PASSED                                  [ 80%]
tests.py::TestYara::testSetConfig PASSED                                 [ 82%]
tests.py::TestYara::testStringIO Fatal Python error: Segmentation fault
Current thread 0x00007fdc4d2d5740 (most recent call first):
  File "/builddir/build/BUILD/yara-python-4.3.1/tests.py", line 1116 in testStringIO
  File "/usr/lib64/python3.12/unittest/case.py", line 589 in _callTestMethod
  File "/usr/lib64/python3.12/unittest/case.py", line 634 in run
  File "/usr/lib64/python3.12/unittest/case.py", line 690 in __call__
  File "/usr/lib/python3.12/site-packages/_pytest/unittest.py", line 333 in runtest
  File "/usr/lib/python3.12/site-packages/_pytest/runner.py", line 169 in pytest_runtest_call
  File "/usr/lib/python3.12/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/lib/python3.12/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/lib/python3.12/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/lib/python3.12/site-packages/_pytest/runner.py", line 262 in <lambda>
  File "/usr/lib/python3.12/site-packages/_pytest/runner.py", line 341 in from_call
  File "/usr/lib/python3.12/site-packages/_pytest/runner.py", line 261 in call_runtest_hook
  File "/usr/lib/python3.12/site-packages/_pytest/runner.py", line 222 in call_and_report
  File "/usr/lib/python3.12/site-packages/_pytest/runner.py", line 133 in runtestprotocol
  File "/usr/lib/python3.12/site-packages/_pytest/runner.py", line 114 in pytest_runtest_protocol
  File "/usr/lib/python3.12/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/lib/python3.12/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/lib/python3.12/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/lib/python3.12/site-packages/_pytest/main.py", line 348 in pytest_runtestloop
  File "/usr/lib/python3.12/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/lib/python3.12/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/lib/python3.12/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/lib/python3.12/site-packages/_pytest/main.py", line 323 in _main
  File "/usr/lib/python3.12/site-packages/_pytest/main.py", line 269 in wrap_session
  File "/usr/lib/python3.12/site-packages/_pytest/main.py", line 316 in pytest_cmdline_main
  File "/usr/lib/python3.12/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/lib/python3.12/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/lib/python3.12/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/lib/python3.12/site-packages/_pytest/config/__init__.py", line 166 in main
  File "/usr/lib/python3.12/site-packages/_pytest/config/__init__.py", line 189 in console_main
  File "/usr/bin/pytest", line 8 in <module>