ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: Ket on June 30, 2022, 10:04:52 AM

Title: Some DJI jpeg files fail with "Use of uninitialized value $val in pattern match"
Post by: Ket on June 30, 2022, 10:04:52 AM
With the release of exiftool 12.42 a small(1 in a set of 798 tested so far) amount of jpeg files taken with a DJI drone (DJI Matrice 300) crashes with the following error:

Use of uninitialized value $val in pattern match (m//) at <myfolder>/lib/Image/ExifTool/DJI.pm line 179, <EXIFTOOL_FILE> chunk 2

The issue appears to be the use of split on the previous line, where it expects to always have a : in the input, and there is nothing initializing $var if : is not there.


178: my ($tag, $val) = split /:/, $1, 2;
179: if ($val =~ /^([\x20-\x7f]+)\0*$/) {
180:        $val = $1;
181:    } else {

Everything appears to work correctly for my current use case if I modify it to enter the if check if $val is undefined. The same image worked fine on previously run exiftool versions(like 12.40) before these got added to the output:

  "AEDebugInfo": "(Binary data 4096 bytes, use -b option to extract)",
  "AEHistogramInfo": "(Binary data 4096 bytes, use -b option to extract)",
  "AELocalHistogram": "(Binary data 2048 bytes, use -b option to extract)",
  "AELiveViewHistogramInfo": "(Binary data 4096 bytes, use -b option to extract)",
  "AELiveViewLocalHistogram": "(Binary data 2048 bytes, use -b option to extract)",
  "AWBDebugInfo": "(Binary data 4096 bytes, use -b option to extract)",
  "AFDebugInfo": "(Binary data 256 bytes, use -b option to extract)",
  "Histogram": "(Binary data 1024 bytes, use -b option to extract)",
  "Xidiri": "(Binary data 512 bytes, use -b option to extract)",
  "GimbalDegree": "303,-197,0",
  "FlightDegree": "125,44,53",
  "ADJDebugInfo": "(Binary data 1024 bytes, use -b option to extract)",

Previous versions gave "Warning": "[minor] Bad MakerNotes directory", in the same spot

Tested on windows and linux running on azure with the command perl <exiftool path> <filepath> -j and both with and without -b
Sadly I'm not allowed by the company to share the problem file.
Title: Re: Some DJI jpeg files fail with "Use of uninitialized value $val in pattern match"
Post by: StarGeek on June 30, 2022, 11:33:20 AM
Thank you for the detailed report.

Phil is currently away until next week, so this will have to wait until then.
Title: Re: Some DJI jpeg files fail with "Use of uninitialized value $val in pattern match"
Post by: Phil Harvey on July 06, 2022, 08:47:32 AM
Thanks for this report.  I'll add a test for undefined values that will appear in ExifTool 12.43 (to be released hopefully later today).

- Phil