Problems with certain DNGs - strong color casts

I'm using 201903 snapshot and having issues with certain DNG files in the RAW converting code we're using.

1) One of them has strong yellow colour cast.

It turns out, one of the elements in the embedded colour matrix array is being overridden due to other array being accessed incorrectly in identify() function dcraw_common.cpp, line 20728:

for (int chan = 0; chan < colors && chan < 4; chan++)
  imgdata.color.linear_max[i] = (maximum-rblack)*imgdata.color.dng_levels.LinearResponseLimit + rblack;

I'm pretty sure linear_max array should be indexed using 'chan', not 'i' index as 'i' at this point might be much bigger than maximum size of linear_max array (and honestly doesn't make much sense to use it here) so it might lead to all sort of weird memory issues. I would appreciate if anyone could confirm it's a mistake/typo.

2) Other problem comes from the fact that in DNGs from 5D MK III , at line 12700 detects multishot related tags even though ExifTool doesn't show this particular tag in the file.

if (tag == 0x4021 && (imgdata.makernotes.canon.multishot[0] = get4()) && (imgdata.makernotes.canon.multishot[1] = get4()))
{
    if (len >= 4)
    {
      imgdata.makernotes.canon.multishot[2] = get4();
      imgdata.makernotes.canon.multishot[3] = get4();
   }
   FORC4 cam_mul[ c ] = 1024;
}

Then, this leads to White Balance of the image being completely wrong (very blue) because it is altered in libraw_cxx.cpp line 2362. If I change above code back to what it was in 0.18 version, that is:

if (tag == 0x4021 && get4() && get4())
  FORC4 cam_mul[ c ] = 1024;

then the White Balance isn't altered and the image looks fine but I would like to understand full implications of that change, particularly as I'm not sure why these multishot tags are detected in the first place.

Forums: 

Could you please provide file

Could you please provide file for analysis (Dropbox/Google Drive/etc link...)

-- Alex Tutubalin @LibRaw LLC