Some DJI jpeg files fail with "Use of uninitialized value $val in pattern match"

Started by Ket, June 30, 2022, 10:04:52 AM

Previous topic - Next topic

Ket

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.

StarGeek

Thank you for the detailed report.

Phil is currently away until next week, so this will have to wait until then.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).