Bug 693578 - graphics/ImageMagick: crash in DrawImage when localized and after SetStrokeColor
Summary: graphics/ImageMagick: crash in DrawImage when localized and after SetStrokeColor
Status: RESOLVED UPSTREAM
Alias: None
Product: openSUSE.org
Classification: openSUSE
Component: 3rd party software (show other bugs)
Version: unspecified
Hardware: x86-64 openSUSE 11.4
: P3 - Medium : Major with 1 vote (vote)
Target Milestone: ---
Assignee: Christopher Yeleighton
QA Contact: E-mail List
URL: http://www.imagemagick.org/discourse-...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-13 08:19 UTC by Christopher Yeleighton
Modified: 2014-11-08 17:27 UTC (History)
1 user (show)

See Also:
Found By: Community User
Services Priority:
Business Priority:
Blocker: Yes
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Yeleighton 2011-05-13 08:19:16 UTC
Program received signal SIGSEGV, Segmentation fault.
TraceBezier (primitive_info=0x7ffff4d14840, number_coordinates=<value optimized out>) at magick/draw.c:5076

I am going to work on this bug myself.  Test case follows.

Aside: Please build IM for 11.4 too (I need -debugsource to get the full backtrace).

/* .NAME wlb \- expose a locale-related bug in MagickWand
 * .SH SYNOPSIS
 * LANG=pl_PL.utf8 gdb wlb
 * .SH BUGS
 * The program crashes with segmentation violation when $LANG == pl_PL.utf8
 *  */

#define TRIGGER_CRASH /* undef to  inhibit the crash */

#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <assert.h>
#include <string.h>
#include <ImageMagick/wand/MagickWand.h>

struct stdnames 
{ char t_locale [07], t_write [06], t_spawn [05], t_empty [01]; } 
const sc_stdnames = { "locale", "write", "spawn" };

static void handle_Magick_error (MagickWand *p_wand)
/* Writes an error message to the standard error */
{ 
	ExceptionType a_sev; 
	register char *const a_descr = MagickGetException (p_wand, &a_sev); 
	if (0 > fprintf (stderr, "%s %s %lu %s", GetMagickModule (), a_descr)) 
{ perror (sc_stdnames. t_write); } MagickRelinquishMemory (a_descr); }
/* !handle_Magick_error X */

int main (int p_arg_count, char const *const p_args []) 
/* 
 * Fills the form with predefined strings.  
 * The form has four pages and the strings are placed on subsequent pages in order.
 */
{ register int a_code = +EXIT_FAILURE; 
		 if (setlocale (LC_ALL, "") == NULL) perror (sc_stdnames. t_locale);
MagickWandGenesis ();
{ register MagickWand *const a_wand = NewMagickWand (); 
if (MagickReadImage (a_wand, "canvas:white") == MagickTrue) /* ?READ_IMAGE_SUCCEEDED Y */  
{ 
	register DrawingWand *const a_draw = NewDrawingWand (); 
	register PixelWand *const a_px = NewPixelWand (); 	/* .H2 FORM DATA */
static unsigned char const sc_message [] = "BUG!";
	PixelSetHSL (a_px, 0, 0, 0);
	#ifdef TRIGGER_CRASH
	DrawSetStrokeColor (a_draw, a_px); 
	#endif
	DrawAnnotation (a_draw, 0, 0, sc_message);
	if (MagickDrawImage (a_wand, a_draw) != MagickTrue) handle_Magick_error (a_wand); 
DestroyPixelWand (a_px); DestroyDrawingWand (a_draw); } 
else /* ?READ_IMAGE_SUCCEEDED N */ handle_Magick_error (a_wand); /* ?READ_IMAGE_SUCCEEDED */ 
DestroyMagickWand (a_wand);
} 
MagickWandTerminus ();
if (fflush (stdout) < 0) 
{ perror (sc_stdnames. t_write); return +EXIT_FAILURE; } else return +a_code;
 }
Comment 1 Petr Gajdos 2011-05-16 17:43:34 UTC
Hmm I cannot reproduce this bug.
Comment 2 Petr Gajdos 2011-05-16 17:47:09 UTC
> Aside: Please build IM for 11.4 too (I need -debugsource to get the full
> backtrace).

Done today morning.
Comment 3 Petr Gajdos 2011-05-17 08:11:43 UTC
Which version of ImageMagick do you use?
Comment 4 Petr Gajdos 2011-09-08 07:32:22 UTC
reassign
Comment 5 Christopher Yeleighton 2014-11-08 17:27:18 UTC
Post by magick ยป 2011-05-18T19:00:51-07:00
We'll use strtod_l() and specify the C locale in ImageMagick 6.6.9-10 Beta to fix the problem you reported.