Blame SOURCES/exiv2-CVE-2020-18898.patch

1ab6b5
diff --git a/src/exiv2.cpp b/src/exiv2.cpp
1ab6b5
index dbd2834..75c6fc2 100644
1ab6b5
--- a/src/exiv2.cpp
1ab6b5
+++ b/src/exiv2.cpp
1ab6b5
@@ -593,41 +593,79 @@ int Params::evalPrint(const std::string& optarg)
1ab6b5
 {
1ab6b5
     int rc = 0;
1ab6b5
     switch (action_) {
1ab6b5
-    case Action::none:
1ab6b5
-        switch (optarg[0]) {
1ab6b5
-        case 's': action_ = Action::print; printMode_ = pmSummary; break;
1ab6b5
-        case 'a': rc = evalPrintFlags("kyct"); break;
1ab6b5
-        case 'e': rc = evalPrintFlags("Ekycv"); break;
1ab6b5
-        case 't': rc = evalPrintFlags("Ekyct"); break;
1ab6b5
-        case 'v': rc = evalPrintFlags("Exgnycv"); break;
1ab6b5
-        case 'h': rc = evalPrintFlags("Exgnycsh"); break;
1ab6b5
-        case 'i': rc = evalPrintFlags("Ikyct"); break;
1ab6b5
-        case 'x': rc = evalPrintFlags("Xkyct"); break;
1ab6b5
-        case 'c': action_ = Action::print; printMode_ = pmComment    ; break;
1ab6b5
-        case 'p': action_ = Action::print; printMode_ = pmPreview    ; break;
1ab6b5
-        case 'C': action_ = Action::print; printMode_ = pmIccProfile ; break;
1ab6b5
-        case 'R': action_ = Action::print; printMode_ = pmRecursive  ; break;
1ab6b5
-        case 'S': action_ = Action::print; printMode_ = pmStructure  ; break;
1ab6b5
-        case 'X': action_ = Action::print; printMode_ = pmXMP        ; break;
1ab6b5
+        case Action::none:
1ab6b5
+            switch (optarg[0]) {
1ab6b5
+                case 's':
1ab6b5
+                    action_ = Action::print;
1ab6b5
+                    printMode_ = pmSummary;
1ab6b5
+                    break;
1ab6b5
+                case 'a':
1ab6b5
+                    rc = evalPrintFlags("kyct");
1ab6b5
+                    break;
1ab6b5
+                case 'e':
1ab6b5
+                    rc = evalPrintFlags("Ekycv");
1ab6b5
+                    break;
1ab6b5
+                case 't':
1ab6b5
+                    rc = evalPrintFlags("Ekyct");
1ab6b5
+                    break;
1ab6b5
+                case 'v':
1ab6b5
+                    rc = evalPrintFlags("Exgnycv");
1ab6b5
+                    break;
1ab6b5
+                case 'h':
1ab6b5
+                    rc = evalPrintFlags("Exgnycsh");
1ab6b5
+                    break;
1ab6b5
+                case 'i':
1ab6b5
+                    rc = evalPrintFlags("Ikyct");
1ab6b5
+                    break;
1ab6b5
+                case 'x':
1ab6b5
+                    rc = evalPrintFlags("Xkyct");
1ab6b5
+                    break;
1ab6b5
+                case 'c':
1ab6b5
+                    action_ = Action::print;
1ab6b5
+                    printMode_ = pmComment;
1ab6b5
+                    break;
1ab6b5
+                case 'p':
1ab6b5
+                    action_ = Action::print;
1ab6b5
+                    printMode_ = pmPreview;
1ab6b5
+                    break;
1ab6b5
+                case 'C':
1ab6b5
+                    action_ = Action::print;
1ab6b5
+                    printMode_ = pmIccProfile;
1ab6b5
+                    break;
1ab6b5
+                case 'R':
1ab6b5
+                #ifdef NDEBUG
1ab6b5
+                    std::cerr << progname() << ": " << _("Action not available in Release mode")
1ab6b5
+                              << ": '" << optarg << "'\n";
1ab6b5
+                    rc = 1;
1ab6b5
+                #else
1ab6b5
+                    action_ = Action::print;
1ab6b5
+                    printMode_ = pmRecursive;
1ab6b5
+                #endif
1ab6b5
+                    break;
1ab6b5
+                case 'S':
1ab6b5
+                    action_ = Action::print;
1ab6b5
+                    printMode_ = pmStructure;
1ab6b5
+                    break;
1ab6b5
+                case 'X':
1ab6b5
+                    action_ = Action::print;
1ab6b5
+                    printMode_ = pmXMP;
1ab6b5
+                    break;
1ab6b5
+                default:
1ab6b5
+                    std::cerr << progname() << ": " << _("Unrecognized print mode") << " `" << optarg << "'\n";
1ab6b5
+                    rc = 1;
1ab6b5
+                    break;
1ab6b5
+            }
1ab6b5
+            break;
1ab6b5
+        case Action::print:
1ab6b5
+            std::cerr << progname() << ": " << _("Ignoring surplus option -p") << optarg << "\n";
1ab6b5
+            break;
1ab6b5
         default:
1ab6b5
-            std::cerr << progname() << ": " << _("Unrecognized print mode") << " `"
1ab6b5
-                      << optarg << "'\n";
1ab6b5
+            std::cerr << progname() << ": " << _("Option -p is not compatible with a previous option\n");
1ab6b5
             rc = 1;
1ab6b5
             break;
1ab6b5
-        }
1ab6b5
-        break;
1ab6b5
-    case Action::print:
1ab6b5
-        std::cerr << progname() << ": "
1ab6b5
-                  << _("Ignoring surplus option -p") << optarg << "\n";
1ab6b5
-        break;
1ab6b5
-    default:
1ab6b5
-        std::cerr << progname() << ": "
1ab6b5
-                  << _("Option -p is not compatible with a previous option\n");
1ab6b5
-        rc = 1;
1ab6b5
-        break;
1ab6b5
     }
1ab6b5
     return rc;
1ab6b5
-} // Params::evalPrint
1ab6b5
+}  // Params::evalPrint
1ab6b5
 
1ab6b5
 int Params::evalPrintFlags(const std::string& optarg)
1ab6b5
 {
1ab6b5
diff --git a/test/data/webp-test.out b/test/data/webp-test.out
1ab6b5
index e92a844..eec850d 100644
1ab6b5
--- a/test/data/webp-test.out
1ab6b5
+++ b/test/data/webp-test.out
1ab6b5
@@ -1,149 +1,3 @@
1ab6b5
-STRUCTURE OF WEBP FILE: exiv2-bug1199.webp
1ab6b5
- Chunk |   Length |   Offset | Payload
1ab6b5
-  RIFF |   187526 |        0 | WEBP
1ab6b5
-  VP8X |       10 |       12 | ,........
1ab6b5
-  ICCP |      560 |       30 | ...0ADBE....mntrRGB XYZ ........
1ab6b5
-  VP8  |   172008 |      598 | .G...*.. .>1..B.!..o.. ......]..
1ab6b5
-  EXIF |    12040 |   172614 | II*........................... .
1ab6b5
-  XMP  |     2864 |   184662 | 
1ab6b5
-STRUCTURE OF WEBP FILE: exiv2-bug1199.webp
1ab6b5
- Chunk |   Length |   Offset | Payload
1ab6b5
-  RIFF |   187526 |        0 | WEBP
1ab6b5
-  VP8X |       10 |       12 | ,........
1ab6b5
-  ICCP |      560 |       30 | ...0ADBE....mntrRGB XYZ ........
1ab6b5
-  VP8  |   172008 |      598 | .G...*.. .>1..B.!..o.. ......]..
1ab6b5
-  EXIF |    12040 |   172614 | II*........................... .
1ab6b5
-  STRUCTURE OF TIFF FILE (II): MemIo
1ab6b5
-   address |    tag                           |      type |    count |    offset | value
1ab6b5
-        10 | 0x0100 ImageWidth                |      LONG |        1 |      1200 | 1200
1ab6b5
-        22 | 0x0101 ImageLength               |      LONG |        1 |       800 | 800
1ab6b5
-        34 | 0x0102 BitsPerSample             |     SHORT |        3 |       194 | 8 8 8
1ab6b5
-        46 | 0x010e ImageDescription          |     ASCII |       37 |       200 |                                  ...
1ab6b5
-        58 | 0x010f Make                      |     ASCII |       18 |       238 | NIKON CORPORATION
1ab6b5
-        70 | 0x0110 Model                     |     ASCII |       12 |       256 | NIKON D5300
1ab6b5
-        82 | 0x0112 Orientation               |     SHORT |        1 |         1 | 1
1ab6b5
-        94 | 0x011a XResolution               |  RATIONAL |        1 |       268 | 300/1
1ab6b5
-       106 | 0x011b YResolution               |  RATIONAL |        1 |       276 | 300/1
1ab6b5
-       118 | 0x0128 ResolutionUnit            |     SHORT |        1 |         2 | 2
1ab6b5
-       130 | 0x0131 Software                  |     ASCII |       11 |       284 | GIMP 2.9.5
1ab6b5
-       142 | 0x0132 DateTime                  |     ASCII |       20 |       296 | 2016:08:13 10:54:16
1ab6b5
-       154 | 0x0213 YCbCrPositioning          |     SHORT |        1 |         1 | 1
1ab6b5
-       166 | 0x8769 ExifTag                   |      LONG |        1 |       316 | 316
1ab6b5
-    STRUCTURE OF TIFF FILE (II): MemIo
1ab6b5
-     address |    tag                           |      type |    count |    offset | value
1ab6b5
-         318 | 0x829a ExposureTime              |  RATIONAL |        1 |       814 | 10/4000
1ab6b5
-         330 | 0x829d FNumber                   |  RATIONAL |        1 |       822 | 100/10
1ab6b5
-         342 | 0x8822 ExposureProgram           |     SHORT |        1 |         0 | 0
1ab6b5
-         354 | 0x8827 ISOSpeedRatings           |     SHORT |        1 |       200 | 200
1ab6b5
-         366 | 0x8830 SensitivityType           |     SHORT |        1 |         2 | 2
1ab6b5
-         378 | 0x9000 ExifVersion               | UNDEFINED |        4 | 808661552 | 0230
1ab6b5
-         390 | 0x9003 DateTimeOriginal          |     ASCII |       20 |       830 | 2015:07:16 15:38:54
1ab6b5
-         402 | 0x9004 DateTimeDigitized         |     ASCII |       20 |       850 | 2015:07:16 15:38:54
1ab6b5
-         414 | 0x9101 ComponentsConfiguration   | UNDEFINED |        4 |    197121 | ...
1ab6b5
-         426 | 0x9102 CompressedBitsPerPixel    |  RATIONAL |        1 |       870 | 2/1
1ab6b5
-         438 | 0x9204 ExposureBiasValue         | SRATIONAL |        1 |       878 | 0/6
1ab6b5
-         450 | 0x9205 MaxApertureValue          |  RATIONAL |        1 |       886 | 43/10
1ab6b5
-         462 | 0x9207 MeteringMode              |     SHORT |        1 |         5 | 5
1ab6b5
-         474 | 0x9208 LightSource               |     SHORT |        1 |         0 | 0
1ab6b5
-         486 | 0x9209 Flash                     |     SHORT |        1 |        16 | 16
1ab6b5
-         498 | 0x920a FocalLength               |  RATIONAL |        1 |       894 | 440/10
1ab6b5
-         510 | 0x927c MakerNote                 | UNDEFINED |     3826 |       902 | Nikon.....II*.....9.+...$...... ...
1ab6b5
-      STRUCTURE OF TIFF FILE (II): MemIo
1ab6b5
-       address |    tag                           |      type |    count |    offset | value
1ab6b5
-            10 | 0x002b                           |     ASCII |       36 |       698 | 48 49 48 48 0 0 2 0 0 0 0 0 0 0  ...
1ab6b5
-            22 | 0x002c                           |     ASCII |     1157 |       734 | 48 49 48 49 35 0 128 2 170 1 0 0 ...
1ab6b5
-            34 | 0x002d                           |     ASCII |        8 |      1892 | 512 0 0
1ab6b5
-            46 | 0x0032                           |     ASCII |       20 |      1900 | 48 49 48 48 1 0 0 0
1ab6b5
-            58 | 0x0035                           |     ASCII |       16 |      1920 | 48 50 48 48 0 0
1ab6b5
-            70 | 0x003b                           |     ASCII |       32 |      1936 | 256/256 256/256 256/256 256/256
1ab6b5
-            82 | 0x003c                           |     ASCII |        2 |        49 | 1
1ab6b5
-            94 | 0x009d                           |     ASCII |        2 |        48 | 0
1ab6b5
-           106 | 0x00a3                           |      BYTE |        1 |         0 | 
1ab6b5
-           118 | 0x00b6                           |     ASCII |       16 |      1968 | 0 0 0 0 0 0 0 0
1ab6b5
-           130 | 0x00bb                           |     ASCII |       26 |      1984 | 48 50 48 48 255 255 255 0
1ab6b5
-           142 | 0x00bf                           |     ASCII |        2 |        48 | 0
1ab6b5
-           154 | 0x00c0                           |     ASCII |       21 |      2010 | 60 1 12 0 144 1 12 0
1ab6b5
-           166 | 0x0022                           |     SHORT |        1 |     65535 | 65535
1ab6b5
-           178 | 0x008a                           |     SHORT |        1 |         1 | 1
1ab6b5
-           190 | 0x001e GPSDifferential           |     SHORT |        1 |         1 | 1
1ab6b5
-           202 | 0x001b GPSProcessingMethod       |     SHORT |        7 |      2032 | 0 6016 4016 6016 4016 ...
1ab6b5
-           214 | 0x0019 GPSDestDistanceRef        | SRATIONAL |        1 |      2046 | 0/6
1ab6b5
-           226 | 0x000e GPSTrackRef               | UNDEFINED |        4 |    786688 | ...
1ab6b5
-           238 | 0x001c GPSAreaInformation        |     SHORT |        3 |      2054 | 0 1 6
1ab6b5
-           250 | 0x0018 GPSDestBearing            | UNDEFINED |        4 |    393472 | ...
1ab6b5
-           262 | 0x0012 GPSMapDatum               | UNDEFINED |        4 |    393472 | ...
1ab6b5
-           274 | 0x0009 GPSStatus                 |     ASCII |       20 |      2060 |                    
1ab6b5
-           286 | 0x0017 GPSDestBearingRef         | UNDEFINED |        4 |    393472 | ...
1ab6b5
-           298 | 0x00a8                           | UNDEFINED |       49 |      2080 | 0106........................... ...
1ab6b5
-           310 | 0x0087                           |      BYTE |        1 |         0 | 
1ab6b5
-           322 | 0x0008 FlashSetting              |     ASCII |       13 |      2130 |             
1ab6b5
-           334 | 0x0007 Focus                     |     ASCII |        7 |      2144 | AF-A  
1ab6b5
-           346 | 0x00b1                           |     SHORT |        1 |         4 | 4
1ab6b5
-           358 | 0x0013 GPSDestLatitudeRef        |     SHORT |        2 |  13107200 | 0 200
1ab6b5
-           370 | 0x0002 ISOSpeed                  |     SHORT |        2 |  13107200 | 0 200
1ab6b5
-           382 | 0x0016 GPSDestLongitude          |     SHORT |        4 |      2152 | 0 0 6000 4000
1ab6b5
-           394 | 0x00a2                           |      LONG |        1 |   6173648 | 6173648
1ab6b5
-           406 | 0x0084                           |  RATIONAL |        4 |      2160 | 180/10 2500/10 35/10 63/10
1ab6b5
-           418 | 0x008b                           | UNDEFINED |        4 |    786743 | 7..
1ab6b5
-           430 | 0x0083                           |      BYTE |        1 |        14 | .
1ab6b5
-           442 | 0x0095                           |     ASCII |        5 |      2192 | OFF 
1ab6b5
-           454 | 0x000d GPSSpeed                  | UNDEFINED |        4 |    393472 | ...
1ab6b5
-           466 | 0x0004 Quality                   |     ASCII |        8 |      2198 | NORMAL 
1ab6b5
-           478 | 0x009e                           |     SHORT |       10 |      2206 | 0 0 0 0 0 ...
1ab6b5
-           490 | 0x001d GPSDateStamp              |     ASCII |        8 |      2226 | 2567806
1ab6b5
-           502 | 0x0089                           |     SHORT |        1 |         0 | 0
1ab6b5
-           514 | 0x00a7                           |      LONG |        1 |      9608 | 9608
1ab6b5
-           526 | 0x00ab                           |     ASCII |       16 |      2234 | AUTO(FLASH OFF)
1ab6b5
-           538 | 0x0001 Version                   | UNDEFINED |        4 | 825307696 | 0211
1ab6b5
-           550 | 0x000c GPSSpeedRef               |  RATIONAL |        4 |      2250 | 538/256 354/256 256/256 256/256
1ab6b5
-           562 | 0x0005 WhiteBalance              |     ASCII |       13 |      2282 | AUTO        
1ab6b5
-           574 | 0x000b ProcessingSoftware        |    SSHORT |        2 |         0 | 0 0
1ab6b5
-           586 | 0x00b7                           | UNDEFINED |       30 |      2296 | 0100....i....................
1ab6b5
-           598 | 0x0097                           | UNDEFINED |     1188 |      2326 | 0219.dU....W..2......:.......F.# ...
1ab6b5
-           610 | 0x00b8                           | UNDEFINED |      172 |      3514 | 0100..e........................ ...
1ab6b5
-           622 | 0x0025                           | UNDEFINED |       14 |      3686 | H.....H......
1ab6b5
-           634 | 0x0098                           | UNDEFINED |       33 |      3700 | 0204.W....z.o..#[.....!o.x..E... ...
1ab6b5
-           646 | 0x00b0                           | UNDEFINED |       16 |      3734 | 0100...........
1ab6b5
-           658 | 0x0023                           | UNDEFINED |       58 |      3750 | 0100STANDARD............STANDARD ...
1ab6b5
-           670 | 0x001f                           | UNDEFINED |        8 |      3808 | 0100...
1ab6b5
-           682 | 0x0024                           | UNDEFINED |        4 |     65536 | ...
1ab6b5
-      END MemIo
1ab6b5
-         522 | 0x9286 UserComment               | UNDEFINED |       44 |      4728 | ........                         ...
1ab6b5
-         534 | 0x9290 SubSecTime                |     ASCII |        3 |     12336 | 00
1ab6b5
-         546 | 0x9291 SubSecTimeOriginal        |     ASCII |        3 |     12336 | 00
1ab6b5
-         558 | 0x9292 SubSecTimeDigitized       |     ASCII |        3 |     12336 | 00
1ab6b5
-         570 | 0xa000 FlashpixVersion           | UNDEFINED |        4 | 808464688 | 0100
1ab6b5
-         582 | 0xa001 ColorSpace                |     SHORT |        1 |         1 | 1
1ab6b5
-         594 | 0xa002 PixelXDimension           |      LONG |        1 |      6000 | 6000
1ab6b5
-         606 | 0xa003 PixelYDimension           |      LONG |        1 |      4000 | 4000
1ab6b5
-         618 | 0xa217 SensingMethod             |     SHORT |        1 |         2 | 2
1ab6b5
-         630 | 0xa300 FileSource                | UNDEFINED |        1 |         3 | .
1ab6b5
-         642 | 0xa301 SceneType                 | UNDEFINED |        1 |         1 | .
1ab6b5
-         654 | 0xa302 CFAPattern                | UNDEFINED |        8 |      4772 | ........
1ab6b5
-         666 | 0xa401 CustomRendered            |     SHORT |        1 |         0 | 0
1ab6b5
-         678 | 0xa402 ExposureMode              |     SHORT |        1 |         0 | 0
1ab6b5
-         690 | 0xa403 WhiteBalance              |     SHORT |        1 |         0 | 0
1ab6b5
-         702 | 0xa404 DigitalZoomRatio          |  RATIONAL |        1 |      4780 | 1/1
1ab6b5
-         714 | 0xa405 FocalLengthIn35mmFilm     |     SHORT |        1 |        66 | 66
1ab6b5
-         726 | 0xa406 SceneCaptureType          |     SHORT |        1 |         0 | 0
1ab6b5
-         738 | 0xa407 GainControl               |     SHORT |        1 |         0 | 0
1ab6b5
-         750 | 0xa408 Contrast                  |     SHORT |        1 |         0 | 0
1ab6b5
-         762 | 0xa409 Saturation                |     SHORT |        1 |         0 | 0
1ab6b5
-         774 | 0xa40a Sharpness                 |     SHORT |        1 |         0 | 0
1ab6b5
-         786 | 0xa40c SubjectDistanceRange      |     SHORT |        1 |         0 | 0
1ab6b5
-         798 | 0xa420 ImageUniqueID             |     ASCII |       33 |      4788 | 090caaf2c085f3e102513b24750041aa ...
1ab6b5
-    END MemIo
1ab6b5
-       178 | 0x8825 GPSTag                    |      LONG |        1 |      4822 | 4822
1ab6b5
-      5072 | 0x0100 ImageWidth                |      LONG |        1 |       256 | 256
1ab6b5
-      5084 | 0x0101 ImageLength               |      LONG |        1 |       170 | 170
1ab6b5
-      5096 | 0x0102 BitsPerSample             |     SHORT |        3 |      5172 | 8 8 8
1ab6b5
-      5108 | 0x0103 Compression               |     SHORT |        1 |         6 | 6
1ab6b5
-      5120 | 0x0106 PhotometricInterpretation |     SHORT |        1 |         6 | 6
1ab6b5
-      5132 | 0x0115 SamplesPerPixel           |     SHORT |        1 |         3 | 3
1ab6b5
-      5144 | 0x0201 JPEGInterchangeFormat     |      LONG |        1 |      5178 | 5178
1ab6b5
-      5156 | 0x0202 JPEGInterchangeFormatLeng |      LONG |        1 |      6861 | 6861
1ab6b5
-  END MemIo
1ab6b5
-  XMP  |     2864 |   184662 | 
1ab6b5
 
1ab6b5
 
1ab6b5
 <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
1ab6b5
diff --git a/test/webp-test.sh b/test/webp-test.sh
1ab6b5
index 04ffe19..9c53293 100755
1ab6b5
--- a/test/webp-test.sh
1ab6b5
+++ b/test/webp-test.sh
1ab6b5
@@ -14,7 +14,6 @@ source ./functions.source
1ab6b5
 
1ab6b5
     copyTestFile                        $filename
1ab6b5
     runTest exiv2 -pS                   $filename
1ab6b5
-    runTest exiv2 -pR                   $filename
1ab6b5
     runTest exiv2 -pX                   $filename | xmllint --format -
1ab6b5
     printf "delete " >&3
1ab6b5
     # test deleting metadata