Bug fixes in png handling

68 views
Skip to first unread message

Mathew Waters

unread,
May 13, 2011, 6:14:00 AM5/13/11
to libHaru
Hi all,

I don't know where the best place to submit patches is, but here goes
- hopefully it will be picked up by someone!

There is a bug repeated in different functions, starting with the
first one:

file: hpdf_image_pdf.c
function: ReadTransparentPaletteData
variable i is defined as UINT, and will cause an infinite loop in a
for loop:

if (!row_ptr[i]) {
for (; i >= 0; i--) {
HPDF_FreeMem (image->mmgr, row_ptr[i]);
}
HPDF_FreeMem (image->mmgr, row_ptr);
return HPDF_FAILD_TO_ALLOC_MEM;
}

Fix is to replace "i >= 0" with "i > 0"

The bug is also present in the function ReadTransparentPngData

I hope that helps!

Antony Dovgal

unread,
May 13, 2011, 7:55:35 AM5/13/11
to lib...@googlegroups.com

Fix pushed, thanks!


--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime statistics for PHP

Bobby Reedy

unread,
May 17, 2011, 8:17:28 AM5/17/11
to lib...@googlegroups.com
Good day,
Prior to now, I have used libHaru with Visual Studio 97 (VS5). We are moving everything to Visual Studio 2010. I am building static libs and they seem to build fine (zlib, libpng and libhpdf). However, I have the problem below when trying to link my application program. The deflate statements are part of zlib.

Has anyone using VS 2010 encountered this type of error? I have spent over a day trying to figure out what I thought was a simple link lib problem, but I have not been able to resolve. Likewise I do not know if the problem is in my application or one of the lib builds.

Any suggestions are greatly appreciated.

Thanks... Bobby Reedy


1>libhpdfs.lib(hpdf_streams.obj) : error LNK2019: unresolved external symbol _deflateEnd referenced in function _HPDF_Stream_WriteToStreamWithDeflate

1>libhpdfs.lib(hpdf_streams.obj) : error LNK2019: unresolved external symbol _deflate referenced in function _HPDF_Stream_WriteToStreamWithDeflate

1>libhpdfs.lib(hpdf_streams.obj) : error LNK2019: unresolved external symbol _deflateInit_ referenced in function _HPDF_Stream_WriteToStreamWithDeflate

Reply all
Reply to author
Forward
0 new messages