Where is info_ptr->pcal_params obtained when reading a PNG file?
Ben Bullock <[email protected]> Sat, 12 Dec 2020 07:39:11 +0900
| Newsgroups | gmane.comp.graphics.png.devel |
|---|---|
| Message-ID | <CAN5Y6m_dvf2UscVM9U=ZPdZdo06BuWFn=HMwzv2xZ2DOHuqA7Q@mail.gmail.com> |
I'm trying to improve the support for the pCAL chunk in my Perl module:
https://metacpan.org/release/Image-PNG-Libpng
Writing a very simple round trip test for this chunk, my program had a
segmentation fault. There is no documentation of the params part of the
chunk so I went to the source code. A simple "grep" of the source code
turned up a surprise:
[ben@mikan] {07:22 40} lpng1637 505 $ grep pcal_params *.c
png.c: if (info_ptr->pcal_params != NULL)
png.c: png_free(png_ptr, info_ptr->pcal_params[i]);
png.c: png_free(png_ptr, info_ptr->pcal_params);
png.c: info_ptr->pcal_params = NULL;
pngget.c: *params = info_ptr->pcal_params;
pngset.c: info_ptr->pcal_params = png_voidcast(png_charpp,
png_malloc_warn(png_ptr,
pngset.c: if (info_ptr->pcal_params == NULL)
pngset.c: memset(info_ptr->pcal_params, 0, ((unsigned int)nparams + 1) *
pngset.c: info_ptr->pcal_params[i] =
(png_charp)png_malloc_warn(png_ptr, length);
pngset.c: if (info_ptr->pcal_params[i] == NULL)
pngset.c: memcpy(info_ptr->pcal_params[i], params[i], length);
pngwrite.c: info_ptr->pcal_units, info_ptr->pcal_params);
There is a facility to set it in pngset, but that is for writing structures.
It looks like there is no actual facility anywhere in the library which
reads or gets the value of info_ptr->pcal_params when reading a PNG file,
and the params pointer is always 0.
The "get" part of this looks like it is adding params as floating point
numbers in the form of strings.
_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement