Hi,

I can understand to not using an special tool for debugging (valgrind).
Maybe Bounds-Checker, You use, does the same or is even better.

To isolate the problem I attach an small programm. Hope this makes visible
the behaviour under osX/win .

best regards
Kai-Uwe


Am 11.08.04, 10:49 +0200 schrieb Marti Maria:

>
> Hi,
>
> Ok, taken a look. Unfortunately, I am not able to spot where the overwrite is.
> I've checked against Windows Bounds-Checker. All ok. And in linux, there is no
> segmentation fault. Installing valgrid is not an option to me, since in the linux at 
> work
> I have not required privileges to install it, and at home I am using cygwin, which is
> unsupported. I could try in the Mac, but I'm afraid this would finish in a true mess.
>
> The functions valgrid are reporting as buggy seems correct... may I abuse of your
> kindness and ask for a simple program that demonstrates the bug? I know this is a
> lot of work, but I'm completely lost without that.
>
> Which I have been trying is something like that:
>
> cmsHPROFILE h = cmsCreate_sRGBProfile()
> printf("%s", cmsTakeManufacturer(h));
>
> Is that correct?
>
> Thanks!
> Marti.
>
>
> ----- Original Message -----
> From: "Kai-Uwe Behrmann" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: "Lcms Liste" <[EMAIL PROTECTED]>
> Sent: Tuesday, August 10, 2004 3:57 PM
> Subject: Re: [Lcms-user] incorrect memory access
>
>
> Hi Marti,
>
> sorry to come with the lcms-1.12 output. Unfortunedly the behaviour still
> remaines lcms-1.13 valgrind-2.1.0:
>

Mit freundlichen Grüßen

Kai-Uwe Behrmann
                                + Bildprogrammierung / Panoramen
                                + Farbmanagement
                                + email: [EMAIL PROTECTED]


#include <lcms.h>

int
main (void) {
    char* daten = NULL;
    int size = 0;
    cmsHPROFILE h = cmsCreate_sRGBProfile();
    cmsHPROFILE l = cmsCreateLabProfile(NULL);

    // Without _cmsSaveProfileToMem all runs fine
  #define USE__cmsSaveProfileToMem
  #ifdef USE__cmsSaveProfileToMem
    _cmsSaveProfileToMem (h, NULL, &size);
    daten = (char*) calloc (sizeof (char), size);
    _cmsSaveProfileToMem (h, daten, &size);
  #endif

    /* The following shows the failed access in cmsReadICCText 

==8994== Invalid read of size 1
==8994==    at 0x40022225: memcpy (mac_replace_strmem.c:257)
==8994==    by 0x402630FE: cmsReadICCText (cmsio1.c:1646)
==8994==    by 0x40264359: cmsTakeProductInfo (cmsio1.c:2309)
==8994==    by 0x804874C: main (in /tmp/RPMS/lcms/Test/text_Fehler/test)
==8994==  Address 0x415F2952 is 2 bytes before a block of size 1276 alloc'd
==8994==    at 0x4002ABF6: malloc (vg_replace_malloc.c:160)
==8994==    by 0x40260FE2: ICCAllocStruct (cmsio1.c:432)
==8994==    by 0x40261089: _cmsCreateProfilePlaceholder (cmsio1.c:455)
==8994==    by 0x40275E3B: cmsCreateRGBProfile (cmsvirt.c:46) */

    printf ("%s:%d %s() %s\n",__FILE__,__LINE__,__func__,
             cmsTakeProductInfo(h));



    cmsHPROFILE profile_array[2];
    profile_array [0] = l; 
    profile_array [1] = h; 

    /* The following example shows the cmsReadICCMatrixRGB2XYZ thing 

==8994== Use of uninitialised value of size 8
==8994==    at 0x4026373D: cmsReadICCMatrixRGB2XYZ (cmsio1.c:1897)
==8994==    by 0x4026E594: cmsBuildOutputMatrixShaper (cmsxform.c:539)
==8994==    by 0x4026F35D: PickTransformRoutine (cmsxform.c:1068)
==8994==    by 0x4026F68B: cmsCreateProofingTransform (cmsxform.c:1259)
==8994== 
==8994== Use of uninitialised value of size 8
==8994==    at 0x4026374A: cmsReadICCMatrixRGB2XYZ (cmsio1.c:1897)
==8994==    by 0x4026E594: cmsBuildOutputMatrixShaper (cmsxform.c:539)
==8994==    by 0x4026F35D: PickTransformRoutine (cmsxform.c:1068)
==8994==    by 0x4026F68B: cmsCreateProofingTransform (cmsxform.c:1259)
==8994== 
==8994== Use of uninitialised value of size 8
==8994==    at 0x40263751: cmsReadICCMatrixRGB2XYZ (cmsio1.c:1897)
==8994==    by 0x4026E594: cmsBuildOutputMatrixShaper (cmsxform.c:539)
==8994==    by 0x4026F35D: PickTransformRoutine (cmsxform.c:1068)
==8994==    by 0x4026F68B: cmsCreateProofingTransform (cmsxform.c:1259)
test.c:34 main() 1096747100 6876  1096761124  
*/

    cmsHTRANSFORM transform = cmsCreateMultiprofileTransform(profile_array,
                                                             2,
                                                             TYPE_Lab_16,
                                                             TYPE_RGB_8,
                                                             1,
                                                             0);

    printf ("%s:%d %s() %d %d  %d\n",__FILE__,__LINE__,__func__,
             h, size, daten);

    cmsCloseProfile (l);
    cmsCloseProfile (h);
    cmsDeleteTransform (transform);
  #ifdef USE__cmsSaveProfileToMem
    free (daten);
  #endif

/*
==9007== 1560 bytes in 3 blocks are definitely lost in loss record 1 of 1
==9007==    at 0x4002ABF6: malloc (vg_replace_malloc.c:160)
==9007==    by 0x4025B7F9: cmsAllocGamma (cmsgamma.c:120)
==9007==    by 0x4025F1A1: CreateLabPrelinearization (cmsgmt.c:955)
==9007==    by 0x4025F467: _cmsComputePrelinearizationTablesFromXFORM (cmsgmt.c:991)
*/

    return TRUE;
}

Reply via email to