File: test_CVE_2018_12265.py

package info (click to toggle)
exiv2 0.28.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 109,208 kB
  • sloc: cpp: 77,571; python: 9,474; javascript: 237; makefile: 190; sh: 172; ansic: 51; sed: 16
file content (24 lines) | stat: -rw-r--r-- 1,110 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- coding: utf-8 -*-

import platform

import system_tests

class AdditionOverflowInLoaderExifJpeg(metaclass=system_tests.CaseMeta):
    """
    Regression test for bug #365:
    https://github.com/Exiv2/exiv2/issues/365
    aka CVE 2018-12265:
    https://cve.mitre.org/cgi-bin/cvename.cgi?name=2018-12265
    """
    filename = system_tests.path("$data_path/1-out-of-read-Poc")
    commands = ["$exiv2 -ep $filename"]
    stdout = [""]
    stderr = [
        """Error: Upper boundary of data for directory Image, entry 0x00fe is out of bounds: Offset = 0x0000002a, size = 64, exceeds buffer size by 22 Bytes; truncating the entry
Warning: Directory Image, entry 0x0201: Strip 0 is outside of the data area; ignored.
Warning: Directory Image, entry 0x0201: Strip 7 is outside of the data area; ignored.
""" +
        ("" if system_tests.BT.Config.is_64bit or any(i for i in ["arm", "ppc"] if i in platform.uname().machine) else "Uncaught exception: Overflow in addition\n")
    ]
    retval = [0 if system_tests.BT.Config.is_64bit or any(i for i in ["arm", "ppc"] if i in platform.uname().machine) else 1]