Reduce maximum recursion depth in exif_data_load_data_content
authorDan Fandrich <dan@coneharvesters.com>
Fri, 20 Apr 2018 16:05:19 +0000 (18:05 +0200)
committerDan Fandrich <dan@coneharvesters.com>
Fri, 20 Apr 2018 16:09:54 +0000 (18:09 +0200)
This only needs to be a small, single digit integer for normal files,
and reducing the maximum closer to this reduces the time and space
needed to detect pathological cases.

libexif/exif-data.c

index 91f4c33..04cdda2 100644 (file)
@@ -378,7 +378,7 @@ exif_data_load_data_content (ExifData *data, ExifIfd ifd,
        if ((((int)ifd) < 0) || ( ((int)ifd) >= EXIF_IFD_COUNT))
          return;
 
-       if (recursion_depth > 30) {
+       if (recursion_depth > 12) {
                exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData",
                          "Deep recursion detected!");
                return;