[argyllcms] Re: dispwin: memory corruption when loading EDID profile

  • From: Török Edwin <edwin+argyll@xxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Tue, 13 Aug 2013 21:57:51 +0300

On 08/13/2013 09:31 PM, Török Edwin wrote:
> Hi,
> 
> Loading an .icc with proper calibration works, but loading one generated from 
> EDID crashes dispwin on Linux x86_64.
> I can reproduce the crash with version 1.5.1 and 1.6.0_beta:
> 
> $ /home/edwin/me/language/C/Argyll_V1.6.0_beta/bin/dispwin -v -d1 -c -I 
> SyncMaster.icc
> About to open dispwin object on the display
> About to clear the calibration
> Dispwin: Warning - No vcgt tag found in profile - assuming linear
> 
> About to install 'SyncMaster.icc' as display's default profile
> *** Error in `/home/edwin/me/language/C/Argyll_V1.6.0_beta/bin/dispwin': 
> malloc(): memory corruption: 0x00000000012cf7e0 ***
> 

The bug appears to be an off-by-one here:
                /* Combined sub-path and profile name */
-               if ((data_pathfile = malloc(strlen(profile_dir) + 1 + 
strlen(profile))) == NULL)
+               if ((data_pathfile = malloc(strlen(profile_dir) + 1 + 
strlen(profile) + 1)) == NULL)

--Edwin

Other related posts: