|
List Info
Thread: png_write_info() crash
|
|
| png_write_info() crash |
  Netherlands |
2007-04-12 13:21:47 |
|
|
this is my code:
void pngWrite( char *file_name, int width, int
height, unsigned char *buffer ) { FILE *fp; png_structp
png_ptr; png_infop info_ptr; png_color_8 sig_bit; int
i; int j; int k; int row; png_bytep
*row_pointers; fopen_s( &fp, file_name,
"wb");
png_ptr = png_create_write_struct(
PNG_LIBPNG_VER_STRING, NULL, NULL, NULL );
if( png_ptr == NULL
) { fclose( fp
); return; }
info_ptr = png_create_info_struct( png_ptr
);
if( info_ptr == NULL
) { fclose( fp
); png_destroy_write_struct( &png_ptr, NULL
); return; }
if( setjmp( png_ptr->jmpbuf )
) { png_destroy_write_struct( &png_ptr,
&info_ptr ); fclose( fp
); return; } png_init_io( png_ptr, fp
); png_set_IHDR( png_ptr, info_ptr, width, height, 8,
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE
); sig_bit.red = 8; sig_bit.green =
8; sig_bit.blue = 8; sig_bit.alpha = 8; png_set_sBIT(
png_ptr, info_ptr, &sig_bit );
png_write_info( png_ptr, info_ptr
);
png_set_packing( png_ptr
); row_pointers = ( png_bytep* )malloc( sizeof( png_bytep ) *
height );
for( row = 0; row < height; row++
) { row_pointers[row] = ( png_bytep )malloc( width * 4
); } if( row_pointers == NULL
) { return; } k =
0; i = 0; while( i < height
) { j = 0; while( j < width * 4
) { row_pointers[i][j+0] =
buffer[k]; k++; row_pointers[i][j+1] =
buffer[k]; k++; row_pointers[i][j+2] =
buffer[k]; k++; row_pointers[i][j+3] =
buffer[k]; k++; j
+=
4; } i++; } png_write_image(png_ptr,
row_pointers); png_write_end(png_ptr,
info_ptr); png_destroy_write_struct(&png_ptr,
&info_ptr); fclose(fp); return; }
my program crashes at png_write_info. what could be
wrong? |
| Re: png_write_info() crash |

|
2007-04-12 13:48:37 |
On 4/12/07, Cas Ebbers <cas.ebbers planet.nl> wrote:
>
> this is my code:
>
> void pngWrite( char *file_name, int width, int height,
unsigned char *buffer
> )
[snip]
> my program crashes at png_write_info. what could be
wrong?
It is worth to mention what exact version of libpng/zlib you
use.
Also, trying to reduce your code to bare minimum enough to
reproduce
the crash would be helpful.
I didn't get a crash with libpng-1.2.8, zlib-1.2.2. I've
used this
main() to call your pngWrite():
int
main(void)
{
unsigned char data[] = { 0, 0, 0, 0 };
pngWrite("1.png", 1, 1, data);
return 0;
}
Regards,
Alex Shulgin
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implement lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement
|
|
| Re: png_write_info() crash |

|
2007-04-12 13:47:03 |
Yes.
On 4/12/07, Thomas Boutell <boutell boutell.com> wrote:
> I'm having trouble finding a working archive of the
list - did my
> vote come through? Thanks.
To find the archive, change "forum=" to
"forum_name=" in the
URL shown in the message headers.
i.e,
http://sourceforge.net/mailarchive/forum.php?foru
m=png-mng-misc
But once you get there, it's miserable trying to search for
votes.
In EUDORA I just click on subject and there they are all
lined
up. But I'm unfortunately not receiving all of them.
willem's and
adeluc's second vote got dumped by Comcast. So I'm not
positive I've seen them all.
Glenn
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implement lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement
|
|
| Re: png_write_info() crash |
  United States |
2007-04-12 13:38:28 |
I'm having trouble finding a working archive of the list -
did my
vote come through? Thanks.
--
Thomas Boutell
Boutell.Com, Inc.
http://www.boutell.com/
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implement lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement
|
|
| Re: png_write_info() crash |
  Netherlands |
2007-04-13 02:39:24 |
I'm using libpng-1.2.16 and zlib-1.2.3.
Weird: when I test your code, it crashes at:
png_set_IHDR( png_ptr, info_ptr, width, height, 8,
PNG_COLOR_TYPE_RGB_ALPHA,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
PNG_FILTER_TYPE_BASE );
When I go back to my own code, it also crashes at
png_set_IHDR. What is
going on?
Regards,
Cas Ebbers
----- Original Message -----
From: "Alexander Shulgin" <alex.shulgin gmail.com>
To: "Discussions about PNG and MNG programming issues,
including development
and use of libpng and libmng" <png-mng-implement lists.sourceforge.net>
Sent: Thursday, April 12, 2007 8:48 PM
Subject: Re: [png-mng-implement] png_write_info() crash
> On 4/12/07, Cas Ebbers <cas.ebbers planet.nl> wrote:
>>
>> this is my code:
>>
>> void pngWrite( char *file_name, int width, int
height, unsigned char
>> *buffer
>> )
> [snip]
>> my program crashes at png_write_info. what could be
wrong?
>
> It is worth to mention what exact version of
libpng/zlib you use.
> Also, trying to reduce your code to bare minimum enough
to reproduce
> the crash would be helpful.
>
> I didn't get a crash with libpng-1.2.8, zlib-1.2.2.
I've used this
> main() to call your pngWrite():
>
> int
> main(void)
> {
> unsigned char data[] = { 0, 0, 0, 0 };
> pngWrite("1.png", 1, 1, data);
> return 0;
> }
>
>
> Regards,
> Alex Shulgin
>
>
------------------------------------------------------------
-------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the
chance to share
> your
> opinions on IT & business topics through brief
surveys-and earn cash
> http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> png-mng-implement mailing list
> png-mng-implement lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implement lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement
|
|
[1-5]
|
|