예제 #1
0
class test_issue_1472Test(metaclass=CaseMeta):

    filename = path("$tmp_path/test_issue_1472.jpg")
    exvfile = path("$tmp_path/test_issue_1472.exv")

    def setUp(self):
        if os.path.isfile(self.exvfile):
            os.remove(self.exvfile)

    commands = [
        "$exiv2 -pa --grep LensType2   $filename",
        "$exiv2  ex                    $filename",
        "$exiv2 -pa --grep LensType2   $exvfile",
        "$exiv2  rm                    $filename",
        "$exiv2 -pa --grep LensType2   $filename",
        "$exiv2  in                    $filename",
        "$exiv2 -pa --grep LensType2   $filename"
    ]
    stdout = [
        "Exif.Sony2010e.LensType2                     Short       1  1024\n",
        "",
        "Exif.Sony2010e.LensType2                     Short       1  1024\n",
        "", "", "",
        "Exif.Sony2010e.LensType2                     Short       1  1024\n"
    ]
    stderr = [""] * len(commands)
    retval = [0, 0, 0, 0, 1, 0, 0]
예제 #2
0
class MetadataPiping(metaclass=system_tests.CaseMeta):

    url = "http://dev.exiv2.org/issues/1137"

    filename = system_tests.path("$data_path/exiv2-empty_copy.jpg")
    Stonehenge = system_tests.path("$data_path/Stonehenge.exv")

    commands = [
        """$exiv2 -pa                   $filename""",
        """$exiv2 -PkV --grep GPSL      $Stonehenge""",
        """$exiv2 -m- $filename""",
        """$exiv2 -pa  --grep GPSL      $filename"""
    ]

    output_grep_GPSL = """set Exif.GPSInfo.GPSLatitudeRef                   N
set Exif.GPSInfo.GPSLatitude                      51/1 106969/10000 0/1
set Exif.GPSInfo.GPSLongitudeRef                  W
set Exif.GPSInfo.GPSLongitude                     1/1 495984/10000 0/1
"""

    stdin = [None, None, output_grep_GPSL, None]

    stdout = [
        "", output_grep_GPSL, "",
        """Exif.GPSInfo.GPSLatitudeRef                  Ascii       2  North
Exif.GPSInfo.GPSLatitude                     Rational    3  51deg 10.69690' 
Exif.GPSInfo.GPSLongitudeRef                 Ascii       2  West
Exif.GPSInfo.GPSLongitude                    Rational    3  1deg 49.59840' 
"""
    ]
예제 #3
0
class test_issue_1180Test(metaclass=CaseMeta):

    filename = path("$tmp_path/test_issue_1180.exv")
    dash_t = path("$tmp_path/20200424_174415.exv")  # -t renames file
    dash_T = path("$tmp_path/20200424_154415.exv")  # -T renames file
    commands = [
        "$exiv2 -K Exif.Image.DateTime       $filename",
        "$exiv2 -t          --force          $filename",
        "$exiv2 -K Exif.Image.DateTime       $dash_t",
        "$exiv2 -a -02:00   --force          $dash_t",
        "$exiv2 -K Exif.Image.DateTime       $dash_t",
        "$exiv2 -t          --force          $dash_t",
        "$exiv2 -K Exif.Image.DateTime       $dash_T"
    ]
    stdout = [
        "Exif.Image.DateTime                          Ascii      50  2020-04-24 17:44:15 \n",
        "",
        "Exif.Image.DateTime                          Ascii      50  2020-04-24 17:44:15 \n",
        "",
        "Exif.Image.DateTime                          Ascii      20  2020:04:24 15:44:15\n",
        "",
        "Exif.Image.DateTime                          Ascii      20  2020:04:24 15:44:15\n"
    ]
    stderr = [""] * len(commands)
    retval = [0] * len(commands)
예제 #4
0
class PngReadRawProfile(metaclass=system_tests.CaseMeta):

    url = "https://github.com/Exiv2/exiv2/issues/428"

    filenames = [
        system_tests.path("$data_path/issue_428_poc1.png"),
        system_tests.path("$data_path/issue_428_poc2.png"),
        system_tests.path("$data_path/issue_428_poc3.png"),
        system_tests.path("$data_path/issue_428_poc4.png"),
        system_tests.path("$data_path/issue_428_poc8.png"),
        system_tests.path("$data_path/issue_428_poc5.png"),
        system_tests.path("$data_path/issue_428_poc6.png"),
        system_tests.path("$data_path/issue_428_poc7.png"),
    ]

    commands = ["$exiv2 " + fname for fname in filenames]
    stdout = [""] * len(filenames)
    stderr = [stderr_exception(fname) for fname in filenames[0:5]]
    stderr.append("""$exiv2_exception_message """ + filenames[5] + """:
$kerCorruptedMetadata
""")
    stderr.append("""Error: XMP Toolkit error 201: XML parsing failure
Warning: Failed to decode XMP metadata.
""" + stderr_exception(filenames[6]))
    stderr.append("""Warning: Failed to decode Exif metadata.
""" + stderr_exception(filenames[7]))

    retval = [1] * len(filenames)
예제 #5
0
class OutOfBoundsReadInPrintStructure(metaclass=system_tests.CaseMeta):

    url = "https://github.com/Exiv2/exiv2/issues/263"

    filenames = [
        system_tests.path("$data_path/9-printStructure-outbound-read-1"),
        system_tests.path("$data_path/10-printStructure-outbound-read-2")
    ]

    commands = ["$exiv2 -pR " + fname for fname in filenames]

    retval = [1] * 2

    compare_stderr = system_tests.check_no_ASAN_UBSAN_errors
    compare_stdout = system_tests.check_no_ASAN_UBSAN_errors
예제 #6
0
class PrintXmpDateOutOfBoundsIndex19(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/issues/1918
    """
    url = "https://github.com/Exiv2/exiv2/issues/1918"

    filename1 = path("$data_path/issue_1918_poc1.jpg")
    filename2 = path("$data_path/issue_1918_poc2.jpg")
    filename3 = path("$data_path/issue_1918_poc3.jpg")
    commands = ["$exiv2 -px $filename1", "$exiv2 -px $filename2", "$exiv2 -px $filename3"]
    stderr = ["", "", ""]
    retval = [0, 0, 0]

    compare_stdout = check_no_ASAN_UBSAN_errors
예제 #7
0
class CheckLensDetectionTeleconverter(metaclass=system_tests.CaseMeta):

    url = "http://dev.exiv2.org/issues/1122"

    filename = system_tests.path("$data_path/exiv2-bug1122.exv")
    commands = [
        "$exiv2 -pv -g Lens $filename",
        "$exiv2 -pa -g Lens $filename",
    ]

    stdout = [
        """0x0016 CanonCs      LensType                    Short       1  173
0x0017 CanonCs      Lens                        Short       3  1000 300 1
0x0095 Canon        LensModel                   Ascii      74  300-1000mm
0xa432 Photo        LensSpecification           Rational    4  300/1 1000/1 0/1 0/1
0xa434 Photo        LensModel                   Ascii      11  300-1000mm
0xa435 Photo        LensSerialNumber            Ascii      11  0000000000
""", """Exif.CanonCs.LensType                        Short       1  Sigma 150-500mm f/5-6.3 APO DG OS HSM + 2x
Exif.CanonCs.Lens                            Short       3  300.0 - 1000.0 mm
Exif.Canon.LensModel                         Ascii      74  300-1000mm
Exif.Photo.LensSpecification                 Rational    4  300/1 1000/1 0/1 0/1
Exif.Photo.LensModel                         Ascii      11  300-1000mm
Exif.Photo.LensSerialNumber                  Ascii      11  0000000000
"""
    ]
    stderr = [""] * len(commands)
    retval = [0] * len(commands)
예제 #8
0
class DenialOfServiceInAdjustTimeOverflow(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/issues/851

    The date parsing code in XMPUtils::ConvertToDate does not
    check that the month and day are in bounds. This can cause a
    denial of service in AdjustTimeOverflow because it adjusts
    out-of-bounds days in a loop that subtracts one month per
    iteration.
    """
    url = "https://github.com/Exiv2/exiv2/issues/851"

    filename = path("$data_path/issue_851_poc.xmp")
    commands = ["$exiv2 $filename"]
    stdout = [
        """File name       : $filename
File size       : 317 Bytes
MIME type       : application/rdf+xml
Image size      : 0 x 0
"""
    ]
    stderr = [
        """Error: XMP Toolkit error 201: Error in XMLValidator
Warning: Failed to decode XMP metadata.
$filename: No Exif data found in the file
"""
    ]
    retval = [253]
예제 #9
0
class TestCvePoC(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/issues/283
    """
    url = "https://github.com/Exiv2/exiv2/issues/283"
    cve_url = "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-11531"

    def check_no_ASAN_UBSAN_errors(self, i, command, got_stderr,
                                   expected_stderr):
        """ Override of system_tests.check_no_ASAN_UBSAN_errors for this particular test case.

        Here we want to also check that the two last lines of got_stderr have the expected_stderr
        """

        check_no_ASAN_UBSAN_errors(self, i, command, got_stderr,
                                   expected_stderr)
        self.assertListEqual(expected_stderr.splitlines(),
                             got_stderr.splitlines()[-2:])

    filename = path("$data_path/pocIssue283.jpg")
    commands = ["$exiv2 $filename"]
    stdout = [""]
    stderr = ["""$exiv2_exception_message $filename:
$kerCorruptedMetadata
"""]
    compare_stderr = check_no_ASAN_UBSAN_errors
    retval = [1]
예제 #10
0
class SegmentationFaultPngImage(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/issues/828
    """
    url = "https://github.com/Exiv2/exiv2/issues/828"

    filename = path("$data_path/issue_828_poc.png")
    commands = ["$exiv2 -pR $filename"]
    stdout = [
        """STRUCTURE OF PNG FILE: $filename
 address | chunk |  length | data                           | checksum
       8 | IHDR  |      13 | .............                  | 0x085f152d
      33 | gAMA  |       4 | ....                           | 0x0bfc6105
      49 | PLTE  |     717 | .........].....Y..q..}..q..y.. | 0x7b35a4a5
     778 | tRNS  |     238 | -U...............}...=..e..... | 0xebd29012
    1028 | bKGD  |       1 | .                              | 0xcfb7d237
    1041 | tEXt  |      14 | Title.IceAlpha                 | 0xc562f8cb
    1067 | tEXt  |      31 | Author.Pieter S. van der Meule | 0x6bfe26a8
    1110 | tEXt  |     411 | Description.The original image | 0xe12effe4
"""
    ]
    stderr = ["""$exiv2_exception_message $filename:
$kerCorruptedMetadata
"""]
    retval = [1]
예제 #11
0
class CrwEncode0x1810IntegerOverflow(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/issues/1530
    """
    url = "https://github.com/Exiv2/exiv2/issues/1530"

    filename1 = path("$data_path/issue_1530_poc.crw")
    filename2 = path("$data_path/issue_1530_poc.exv")
    commands = ["$exiv2 in $filename1 $filename2"]
    stdout = [""]
    stderr = [
        """$filename1: Could not write metadata to file: $kerCorruptedMetadata
"""
    ]
    retval = [1]
예제 #12
0
class BigTiffImageRecursionStackExhaustion(metaclass=system_tests.CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/issues/712

    A malicious input file can cause BigTiffImage::printIFD() to
    recurse arbitrarily deep, causing a crash due to stack exhaustion.

    The bug only existed in the -pR mode, which is now only enabled
    in debug builds.
    """
    url = "https://github.com/Exiv2/exiv2/issues/790"

    filename = system_tests.path("$data_path/issue_712_poc.tif")
    commands = ["$exiv2 -b -u -k pr $filename"]
    stdout = [
        "File name       : " + filename + """
File size       : 3720 Bytes
MIME type       : 
Image size      : 0 x 0
"""
    ]
    stderr = [filename + """: No Exif data found in the file
"""]
    retval = [253]
예제 #13
0
class DontSegfaultWhenAccessingFocalLength(metaclass=CaseMeta):

    url = "http://dev.exiv2.org/issues/855"

    filename = path("$data_path/exiv2-bug855.jpg")

    commands = ["$exiv2 -pa -b $filename"]

    stdout = ["""Exif.Image.NewSubfileType                    Long        1  Thumbnail/Preview image
Exif.Image.Make                              Ascii      20  PENTAX             
Exif.Image.Model                             Ascii      20  PENTAX K-x         
Exif.Image.Orientation                       Short       1  top, left
Exif.Image.Software                          Ascii      16  darktable 0.9.3
Exif.Image.DateTime                          Ascii      20  2012:01:22 01:54:26
Exif.Image.Artist                            Ascii      17  SEBASTIAN WAGNER
Exif.Image.Rating                            SLong       1  1
Exif.Image.RatingPercent                     SLong       1  20
Exif.Image.Copyright                         Ascii      33  CREATIVECOMMONS ATTRIBUTION CCBY
Exif.Image.ExifTag                           Long        1  666
Exif.Photo.ExposureTime                      Rational    1  1/20 s
Exif.Photo.FNumber                           Rational    1  F5.6
Exif.Photo.ExposureProgram                   Short       1  Landscape mode
Exif.Photo.ISOSpeedRatings                   Short       1  2500
Exif.Photo.DateTimeOriginal                  Ascii      20  2012:01:22 01:54:26
Exif.Photo.DateTimeDigitized                 Ascii      20  2012:01:22 01:54:26
Exif.Photo.ExposureBiasValue                 SRational   1  0 EV
Exif.Photo.MeteringMode                      Short       1  Multi-segment
Exif.Photo.Flash                             Short       1  No, compulsory
Exif.Photo.FocalLength                       Rational    0  
Exif.Photo.ColorSpace                        Short       1  sRGB
Exif.Photo.SensingMethod                     Short       1  One-chip color area
Exif.Photo.CustomRendered                    Short       1  Normal process
Exif.Photo.ExposureMode                      Short       1  Auto
Exif.Photo.WhiteBalance                      Short       1  Auto
Exif.Photo.FocalLengthIn35mmFilm             Short       1  82.0 mm
Exif.Photo.SceneCaptureType                  Short       1  Landscape
Exif.Photo.Contrast                          Short       1  Hard
Exif.Photo.Saturation                        Short       1  Normal
Exif.Photo.Sharpness                         Short       1  Hard
Exif.Photo.SubjectDistanceRange              Short       1  Macro
Exif.Image.DNGVersion                        Byte        4  1 1 0 0
Exif.Image.DNGBackwardVersion                Byte        4  1 1 0 0
Exif.Image.UniqueCameraModel                 Ascii      11  PENTAX K-x
Exif.Image.ColorMatrix1                      SRational   9  71147/65536 -36788/65536 223/65536 -28867/65536 69463/65536 28977/65536 -1276/65536 2064/65536 45215/65536
Exif.Image.ColorMatrix2                      SRational   9  68429/65536 -21793/65536 -7522/65536 -36512/65536 89125/65536 14083/65536 -7905/65536 11496/65536 48817/65536
Exif.Image.AnalogBalance                     Rational    3  1/1 1/1 1/1
Exif.Image.AsShotNeutral                     Rational    3  256/352 256/264 256/762
Exif.Image.BaselineExposure                  SRational   1  -31775/65536
Exif.Image.BaselineNoise                     Rational    1  1/1
Exif.Image.BaselineSharpness                 Rational    1  1/1
Exif.Image.LinearResponseLimit               Rational    1  1/1
Exif.Image.CalibrationIlluminant1            Short       1  Standard light A
Exif.Image.CalibrationIlluminant2            Short       1  D65
"""
    ]
    stderr = [
        """Error: Upper boundary of data for directory Photo, entry 0x920a is out of bounds: Offset = 0x000003dc, size = 8, exceeds buffer size by 6 Bytes; truncating the entry
"""
    ]
    retval = [0]
예제 #14
0
class test_issue_1046Test(metaclass=CaseMeta):

    filename = path("$data_path/IMG_0246_copy.exv")
    # Use the """ string syntax for -M"set Bla.Dee.Bla" commands to ensure they run on Windows!
    commands  = [  "$exiv2 -pt -b -g GPSInfo -g UserCom    $filename"
                ,  "$exiv2 -pv -b -g GPSInfo -g UserCom    $filename"
                ,"""$exiv2 -M"set Exif.Photo.UserComment charset=Ascii how now brown cow" $filename"""
                ,  "$exiv2 -pt -b           -g UserComment $filename"
                ,  "$exiv2 -pv -b           -g UserComment $filename"
                ,"""$exiv2 -M"set Exif.Photo.UserComment charset=Unicode \u0041\u0042" $filename"""
                ,  "$exiv2 -pt -b           -g UserComment $filename"
                ,  "$exiv2 -pv -b           -g UserComment $filename"
                ,"""$exiv2 -M"set Exif.Photo.UserComment hello world" $filename"""
                ,  "$exiv2 -pt -b           -g UserComment $filename"
                ,  "$exiv2 -pv -b           -g UserComment $filename"
                ,"""$exiv2 -M"set Exif.GPSInfo.GPSProcessingMethod charset=Unicode \u0052\u006f\u0062\u0069\u006e" $filename"""
                ,"""$exiv2 -M"set Exif.GPSInfo.GPSAreaInformation  charset=Ascii area information"                 $filename"""
                ,  "$exiv2 -pt -b -g GPSPro -g GPSArea      $filename"
                ,  "$exiv2 -pv -b -g GPSPro -g GPSArea      $filename"
                ]
    stdout = ["""Exif.Photo.UserComment                       Undefined  12  charset=Unicode AB
Exif.GPSInfo.GPSVersionID                    Byte        4  2.2.0.0
Exif.GPSInfo.GPSLatitudeRef                  Ascii       2  North
Exif.GPSInfo.GPSLatitude                     Rational    3  51 deg 23' 13"
Exif.GPSInfo.GPSLongitudeRef                 Ascii       2  West
Exif.GPSInfo.GPSLongitude                    Rational    3  0 deg 44' 27"
Exif.GPSInfo.GPSAltitudeRef                  Byte        1  Above sea level
Exif.GPSInfo.GPSAltitude                     Rational    1  104.2 m
Exif.GPSInfo.GPSTimeStamp                    Rational    3  10:34:11
Exif.GPSInfo.GPSMapDatum                     Ascii       7  WGS-84
Exif.GPSInfo.GPSProcessingMethod             Undefined  18  charset=Ascii HYBRID-FIX
Exif.GPSInfo.GPSAreaInformation              Undefined  23  Surrey, England
Exif.GPSInfo.GPSDateStamp                    Ascii      20  2020:02:02 10:34:11
""","""0x9286 Photo        UserComment                 Undefined  12  charset=Unicode AB
0x0000 GPSInfo      GPSVersionID                Byte        4  2 2 0 0
0x0001 GPSInfo      GPSLatitudeRef              Ascii       2  N
0x0002 GPSInfo      GPSLatitude                 Rational    3  51/1 23/1 13/1
0x0003 GPSInfo      GPSLongitudeRef             Ascii       2  W
0x0004 GPSInfo      GPSLongitude                Rational    3  0/1 44/1 27/1
0x0005 GPSInfo      GPSAltitudeRef              Byte        1  0
0x0006 GPSInfo      GPSAltitude                 Rational    1  10420/100
0x0007 GPSInfo      GPSTimeStamp                Rational    3  10/1 34/1 11/1
0x0012 GPSInfo      GPSMapDatum                 Ascii       7  WGS-84
0x001b GPSInfo      GPSProcessingMethod         Undefined  18  charset=Ascii HYBRID-FIX
0x001c GPSInfo      GPSAreaInformation          Undefined  23  Surrey, England
0x001d GPSInfo      GPSDateStamp                Ascii      20  2020:02:02 10:34:11
""","","""Exif.Photo.UserComment                       Undefined  25  charset=Ascii how now brown cow
""","""0x9286 Photo        UserComment                 Undefined  25  charset=Ascii how now brown cow
""","","""Exif.Photo.UserComment                       Undefined  12  charset=Unicode AB
""","""0x9286 Photo        UserComment                 Undefined  12  charset=Unicode AB
""","","""Exif.Photo.UserComment                       Undefined  19  hello world
""","""0x9286 Photo        UserComment                 Undefined  19  hello world
""","","","""Exif.GPSInfo.GPSProcessingMethod             Undefined  18  charset=Unicode Robin
Exif.GPSInfo.GPSAreaInformation              Undefined  24  charset=Ascii area information
""","""0x001b GPSInfo      GPSProcessingMethod         Undefined  18  charset=Unicode Robin
0x001c GPSInfo      GPSAreaInformation          Undefined  24  charset=Ascii area information
"""
             ]
    stderr = [""]*len(commands)
    retval = [ 0]*len(commands)
예제 #15
0
class BigTiffImageRecursionStackExhaustion(metaclass=system_tests.CaseMeta):
    """
    src/bigtiffimage.cpp is longer in the code base
    however, let's retain this test as support for BigTiff will
    be developed and the malicious test file may stress the bigtiff parser.
    
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/issues/712

    A malicious input file can cause BigTiffImage::printIFD() to
    recurse arbitrarily deep, causing a crash due to stack exhaustion.

    The bug only existed in the -pR mode, which is now only enabled
    in debug builds.
    """
    url = "https://github.com/Exiv2/exiv2/issues/790"

    filename = system_tests.path("$data_path/issue_712_poc.tif")
    commands = ["$exiv2 -b -u -k pr $filename"]
    stdout = [""]
    stderr = [
        """$exiv2_exception_message """ + filename + """:
$filename: $kerFileContainsUnknownImageType
"""
    ]
    retval = [1]
예제 #16
0
class CheckXmlLang(metaclass=system_tests.CaseMeta):

    url = "http://dev.exiv2.org/issues/1058"

    filename = system_tests.path("$data_path/exiv2-empty_copy.jpg")
    commands = [
        ## Add titles in 2 languages and one default
        """$exiv2 -M"set Xmp.dc.title lang=de-DE GERMAN"  $filename""",
        """$exiv2 -M"set Xmp.dc.title lang=en-GB BRITISH" $filename""",
        """$exiv2 -M"set Xmp.dc.title Everybody else"     $filename""",
        """$exiv2 -px                                     $filename""",
        ## Remove languages, test case for the language
        """$exiv2 -M"set Xmp.dc.title lang=DE-de german"  $filename""",
        """$exiv2 -M"set Xmp.dc.title lang=EN-gb"         $filename""",
        """$exiv2 -M"set Xmp.dc.title"                    $filename""",
        """$exiv2 -px                                     $filename""",
    ]

    stdout = [
        "",
        "",
        "",
        """Xmp.dc.title                                 LangAlt     3  lang="x-default" Everybody else, lang="en-GB" BRITISH, lang="de-DE" GERMAN
""",
        "",
        "",
        "",
        """Xmp.dc.title                                 LangAlt     1  lang="de-DE" german
""",
    ]

    stderr = [""] * len(commands)
    retval = [0] * len(commands)
예제 #17
0
class TestDefaultCommandGrep(metaclass=system_tests.CaseMeta):

    url = "https://github.com/Exiv2/exiv2/issues/818"

    filename = system_tests.path("$data_path/Reagan.jpg")
    commands = [
        "$exiv2     -g Date $filename",
        "$exiv2 -px -g Date $filename",
    ]
    retval = [0, 0]
    stderr = [""] * 2
    retval = [0] * 2

    stdout = [
        """Exif.Image.DateTime                          Ascii      20  2016:09:13 11:58:16
Exif.Photo.DateTimeOriginal                  Ascii      20  2004:06:21 23:37:53
Exif.Photo.DateTimeDigitized                 Ascii      20  2004:06:21 23:37:53
Iptc.Application2.DateCreated                Date        8  2004-06-21
Iptc.Application2.DigitizationDate           Date        8  2004-06-21
Xmp.xmp.ModifyDate                           XmpText    25  2016-09-13T11:58:16+01:00
Xmp.xmp.CreateDate                           XmpText    25  2004-06-21T23:37:53+01:00
Xmp.xmp.MetadataDate                         XmpText    25  2016-09-13T11:58:16+01:00
Xmp.photoshop.DateCreated                    XmpText    10  2004-06-21\n""",
        """Xmp.xmp.ModifyDate                           XmpText    25  2016-09-13T11:58:16+01:00
Xmp.xmp.CreateDate                           XmpText    25  2004-06-21T23:37:53+01:00
Xmp.xmp.MetadataDate                         XmpText    25  2016-09-13T11:58:16+01:00
Xmp.photoshop.DateCreated                    XmpText    10  2004-06-21\n"""
    ]
예제 #18
0
class MinoltaDivZero(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/security/advisories/GHSA-pvjp-m4f6-q984
    """
    url = "https://github.com/Exiv2/exiv2/security/advisories/GHSA-pvjp-m4f6-q984"

    filename = path("$data_path/issue_ghsa_pvjp_m4f6_q984_poc.exv")
    commands = ["$exiv2 -p t $filename"]
    stderr = [
        """Error: Upper boundary of data for directory Image, entry 0x011a is out of bounds: Offset = 0x000000f2, size = 14155784, exceeds buffer size by 14110766 Bytes; truncating the entry
Error: Offset of directory Photo, entry 0x829a is out of bounds: Offset = 0x6d00035e; truncating the entry
Error: Upper boundary of data for directory Photo, entry 0x8822 is out of bounds: Offset = 0x00000003, size = 56834, exceeds buffer size by 11577 Bytes; truncating the entry
Error: Upper boundary of data for directory Photo, entry 0x8827 is out of bounds: Offset = 0x00000640, size = 1179650, exceeds buffer size by 1135990 Bytes; truncating the entry
Warning: Directory Photo, entry 0x8832 has unknown Exif (TIFF) type 49; setting type size 1.
Error: Offset of directory Sony2, entry 0x2006 is out of bounds: Offset = 0x00000000; truncating the entry
Warning: Directory Sony2, entry 0x20c1 has unknown Exif (TIFF) type 181; setting type size 1.
Error: Offset of directory Sony2, entry 0x2063 is out of bounds: Offset = 0x00000000; truncating the entry
Error: Offset of directory Sony2, entry 0x3000 is out of bounds: Offset = 0x0057097c; truncating the entry
Error: Offset of directory Sony2, entry 0x0115 is out of bounds: Offset = 0x00000000; truncating the entry
Error: Upper boundary of data for directory Sony2, entry 0x2013 is out of bounds: Offset = 0x00000002, size = 37486596, exceeds buffer size by 37441338 Bytes; truncating the entry
Warning: Directory Photo, entry 0xa003 has unknown Exif (TIFF) type 242; setting type size 1.
Warning: Directory Iop has an unexpected next pointer; ignored.
Warning: Directory Photo, entry 0xa402 has unknown Exif (TIFF) type 89; setting type size 1.
Error: Offset of directory Photo, entry 0xa402 is out of bounds: Offset = 0x00000000; truncating the entry
Error: Offset of directory Thumbnail, entry 0x0132 is out of bounds: Offset = 0xff00968b; truncating the entry
"""
    ]
    retval = [0]

    def compare_stdout(self, i, command, got_stdout, expected_stdout):
        """ We don't care about the stdout, just don't crash """
        pass
예제 #19
0
class SonyMisc2bTestUnsupported(metaclass=CaseMeta):

    filename = path("$data_path/exiv2-pr906.exv")
    commands = ["$exiv2 -pa --grep SonyMisc2b $filename"]

    stdout = [""]
    stderr = [""]
    retval = [1]
예제 #20
0
class SonyPreviewImageLargeAllocation(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/issues/1881
    """
    url = "https://github.com/Exiv2/exiv2/issues/1881"

    filename1 = path("$tmp_path/issue_1881_poc.jpg")
    filename2 = path("$tmp_path/issue_1881_coverage.jpg")
    commands = ["$exiv2 -q -d I rm $filename1", "$exiv2 -q -d I rm $filename2"]
    stdout = ["", ""]
    stderr = [
        """Exiv2 exception in erase action for file $filename1:
$kerCorruptedMetadata
""", ""
    ]
    retval = [1, 0]
class Jp2ImageEncodeJp2HeaderOutOfBoundsRead(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/security/advisories/GHSA-8949-hhfh-j7rj
    """
    url = "https://github.com/Exiv2/exiv2/security/advisories/GHSA-8949-hhfh-j7rj"

    filename1 = path("$tmp_path/issue_ghsa_8949_hhfh_j7rj_poc.jp2")
    filename2 = path("$tmp_path/issue_ghsa_8949_hhfh_j7rj_poc.exv")
    commands = ["$exiv2 in $filename1"]
    stdout = [""]
    stderr = [
        """Error: XMP Toolkit error 201: Error in XMLValidator
Warning: Failed to decode XMP metadata.
"""
    ]
    retval = [0]
예제 #22
0
class SonyMisc3cUnsupportedTest(metaclass=CaseMeta):

    filename = path("$data_path/test_issue_1464.exv")
    commands = ["$exiv2 -pa --grep SonyMisc3c $filename"]

    stdout = [""""""]
    stderr = [""]
    retval = [1]
예제 #23
0
class TestExiv2ExtractThumbnailToStdout(metaclass=CaseMeta):
    """
    Regression test for 'extracting a thumbnail to stdout' bug described in:
    https://github.com/Exiv2/exiv2/issues/1934
    """
    url = "https://github.com/Exiv2/exiv2/issues/1934"

    filename1 = path("$tmp_path/issue_1934_poc1.exv")
    filename2 = path("$tmp_path/issue_1934_poc1-thumb.jpg")
    filename3 = path("$data_path/issue_1934_poc1-thumb.jpg")
    commands = ["$exiv2 --force --extract t- $filename1 > $filename2",
                "cmp $filename2 $filename3"
               ]
    stderr = [""]*2
    retval = [0]*2

    compare_stdout = check_no_ASAN_UBSAN_errors
예제 #24
0
class test_issue_ghsa_mv9g_fxh2_m49m(metaclass=CaseMeta):

    filename = path("$data_path/test_issue_ghsa_mv9g_fxh2_m49m.crw")
    commands  = ["$exiv2 -q fi $filename"]
    stdout = [""]
    stderr = ["""Exiv2 exception in fixiso action for file $filename:
$kerCorruptedMetadata
"""]
    retval = [1]
class WebPImageDoWriteMetadataOutOfBoundsRead(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/security/advisories/GHSA-5p8g-9xf3-gfrr
    """
    url = "https://github.com/Exiv2/exiv2/security/advisories/GHSA-5p8g-9xf3-gfrr"

    filename1 = path("$data_path/issue_ghsa_5p8g_9xf3_gfrr_poc.webp")
    filename2 = path("$data_path/issue_ghsa_5p8g_9xf3_gfrr_poc.exv")
    commands = ["$exiv2 in $filename1"]
    stdout = [""]
    stderr = [
        """Warning: Directory Nikon3, entry 0x002b has unknown Exif (TIFF) type 64002; setting type size 1.
Warning: Directory Nikon3, entry 0x002b has unknown Exif (TIFF) type 64002; setting type size 1.
$filename1: Could not write metadata to file: $kerCorruptedMetadata
"""
    ]
    retval = [1]
예제 #26
0
class DetectsWrongLengthOfImageResourceInPSDFile(metaclass=system_tests.CaseMeta):
    url = "https://github.com/Exiv2/exiv2/issues/426"

    filename = system_tests.path("$data_path/h02.psd")
    commands = ["$exiv2 " + filename]
    retval = [1]
    stderr = ["""$exiv2_exception_message """ + filename + """:
$kerCorruptedMetadata
"""]
예제 #27
0
class ShouldNotThrowsWithSpecificIsoSpeedValue(metaclass=system_tests.CaseMeta
                                               ):
    url = "https://github.com/Exiv2/exiv2/issues/561"

    filename = system_tests.path("$data_path/pocIssue561")
    commands = ["$exiv2 " + filename]
    retval = [0]
    compare_stderr = system_tests.check_no_ASAN_UBSAN_errors
    compare_stdout = system_tests.check_no_ASAN_UBSAN_errors
예제 #28
0
class SonyMisc1Test(metaclass=CaseMeta):

    filename = path("$data_path/exiv2-pr906.exv")
    commands = ["$exiv2 -pa --grep SonyMisc1 $filename"]

    stdout = ["""Exif.SonyMisc1.CameraTemperature             SByte       1  26 °C
"""
    ]
    stderr = [""]
    retval = [0]
예제 #29
0
class RafNoTiffRegression(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/issues/1791
    """
    url = "https://github.com/Exiv2/exiv2/issues/1791"

    filename1 = path("$data_path/issue_1791_old.raf")
    filename2 = path("$data_path/issue_1791_new.raf")
    commands = ["$exiv2 -pa $filename1", "$exiv2 -pa $filename2"]
    stdout = ["""Exif.Image2.JPEGInterchangeFormat            Long        1  104
Exif.Image2.JPEGInterchangeFormatLength      Long        1  12
""",
              """Exif.Image2.JPEGInterchangeFormat            Long        1  104
Exif.Image2.JPEGInterchangeFormatLength      Long        1  12
Exif.Image.NewSubfileType                    Long        1  Primary image
"""]
    stderr = ["", ""]
    retval = [0, 0]
예제 #30
0
class MrmImageLargeAllocation(metaclass=CaseMeta):
    """
    Regression test for the bug described in:
    https://github.com/Exiv2/exiv2/pull/943
    """
    url = "https://github.com/Exiv2/exiv2/pull/943"

    filename1 = path("$data_path/issue_943_poc1.mrm")
    filename2 = path("$data_path/issue_943_poc2.mrm")
    commands = ["$exiv2 $filename1", "$exiv2 $filename2"]
    stdout = ["", ""]
    stderr = [
        """Exiv2 exception in print action for file $filename1:
Failed to read image data
""", """Exiv2 exception in print action for file $filename2:
Failed to read image data
"""
    ]
    retval = [1, 1]