#3 PdfCMap::SetCIDSystemInfo Bug Patch

closed
nobody
None
5
2006-07-27
2005-12-14
Dae-Myung Kang
No

This is the code that SetCIDSystemInfo function in
PdfCMap

if (registry != NULL) {
Problem-->fRegistry = new char[strlen(registry+1)];
PDF_DEBUG_PRINT(("++ [%x] fRegistry new.\n",
(int)fRegistry));
strcpy(fRegistry, registry);
}
if (ordering != NULL) {
Problem-->fOrdering = new char[strlen(ordering+1)];
PDF_DEBUG_PRINT(("++ [%x] fOrdering new.\n",
(int)fOrdering));
strcpy(fOrdering, ordering);
}

this code make the memory problem.

I suggest this code.

fRegistry = new char[strlen(registry)+1];
fOrdering = new char[strlen(ordering)+1];

and PdfCMap::~PdfCMap() has bug too.

fRegistry and fOrdering is array type.

but this code make error;
delete fRegistry;
delete fOrdering;

so, i changed this code.

if ( fRegistry ) delete [] fRegistry;
if ( fOrdering ) delete [] fOrdering;

Discussion

  • takeshi kanno
    takeshi kanno
    2006-07-27

    • status: open --> closed