LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-18-2009, 05:40 AM   #1
pramod.srk
Member
 
Registered: Feb 2009
Posts: 47

Rep: Reputation: 15
Error : constitute.c: ReadImage: Assertion `image_info->signature


Dear All,

I am getting the following error while running CGI script written in C Lang.

constitute.c:1784: ReadImage: Assertion `image_info->signature == 0xabacadab' failed

I am stuck into this problem.


Thanks in Advance.

Thanks and Regards
Pramod
 
Old 06-18-2009, 10:35 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
What does the code surrounding line 1784 in file 'constitute.c' suggest? You haven't given anything resembling enough detail to answer any question(s); in fact, you haven't asked a question.
--- rod.
 
Old 06-18-2009, 11:06 AM   #3
pramod.srk
Member
 
Registered: Feb 2009
Posts: 47

Original Poster
Rep: Reputation: 15
Thanks for the reply.

Sorry for not giving proper details.

My program uses LibMagick library. This library internally linked with constitute.c.

constitute.c is come up with LibMAgick source.

I installed LibMagick in /usr/local/lib.

Please look following source from constitute.c


MagickExport Image *ReadImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
filename[MaxTextExtent];

DelegateInfo
*delegate_info;

Image
*image,
*next;

ImageInfo
*clone_info;

MagickInfo
*magick_info;

register char
*p;

/*
Determine image type from filename prefix or suffix (e.g. image.jpg).
*/
assert(image_info != (ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image_info->filename != (char *) NULL);
assert(exception != (ExceptionInfo *) NULL);[/B]
GetExceptionInfo(exception);
clone_info=CloneImageInfo(image_info);
if (*clone_info->filename == '@')
return(ReadImages(clone_info,exception));
SetImageInfo(clone_info,False,exception);
(void) strcpy(filename,clone_info->filename);
/*
Call appropriate image reader based on image type.
*/
image=(Image *) NULL;
magick_info=(MagickInfo *) GetMagickInfo(clone_info->magick,exception);
if ((magick_info != (MagickInfo *) NULL) &&
(magick_info->decoder !=
(Image *(*)(const ImageInfo *,ExceptionInfo *)) NULL))
{
clone_info->client_data=magick_info->client_data;
image=(magick_info->decoder)(clone_info,exception);
}
else
{
unsigned int
status;

delegate_info=GetDelegateInfo(clone_info->magick,(char *) NULL,exception);
if (delegate_info == (DelegateInfo *) NULL)
{
if (IsAccessible(clone_info->filename))
ThrowException(exception,MissingDelegateWarning,
"no delegate for this image format",clone_info->filename);
else
ThrowException(exception,FileOpenWarning,"Unable to open file",
clone_info->filename);
DestroyImageInfo(clone_info);
return((Image *) NULL);
}
/*
Let our decoding delegate process the image.
*/
image=AllocateImage(clone_info);
if (image == (Image *) NULL)
{
DestroyImageInfo(clone_info);
return((Image *) NULL);
}
(void) strcpy(image->filename,clone_info->filename);
TemporaryFilename(clone_info->filename);
status=
InvokeDelegate(clone_info,image,clone_info->magick,(char *) NULL);
ThrowException(exception,image->exception.severity,
image->exception.reason,image->exception.description);
DestroyImages(image);
image=(Image *) NULL;
if (status != False)
clone_info->temporary=True;
SetImageInfo(clone_info,False,exception);
magick_info=(MagickInfo *) GetMagickInfo(clone_info->magick,exception);
if ((magick_info == (MagickInfo *) NULL) ||
(magick_info->decoder ==
(Image *(*)(const ImageInfo *,ExceptionInfo *)) NULL))
{
if (IsAccessible(clone_info->filename))
ThrowException(exception,MissingDelegateWarning,
"no delegate for this image format",clone_info->filename);
else
ThrowException(exception,FileOpenWarning,"Unable to open file",
clone_info->filename);
DestroyImageInfo(clone_info);
return((Image *) NULL);
}
image=(magick_info->decoder)(clone_info,exception);
}
if (clone_info->temporary)
{
(void) remove(clone_info->filename);
clone_info->temporary=False;
if (image != (Image *) NULL)
(void) strcpy(image->filename,filename);
}
if (image == (Image *) NULL)
{
DestroyImageInfo(clone_info);
return(image);
}
if (image->temporary)
(void) remove(clone_info->filename);
if (IsSubimage(clone_info->tile,False))
{
int
count,
offset,
quantum;

Image
*subimages;

unsigned int
last,
target;

/*
User specified subimages (e.g. image.miff[1,3-5,7-6,2]).
*/
subimages=(Image *) NULL;
target=atoi(clone_info->tile);
for (p=clone_info->tile; *p != '\0'; p+=Max(offset,1))
{
offset=0;
count=sscanf(p,"%u%n-%u%n",&target,&offset,&last,&offset);
if (count == 0)
continue;
if (count == 1)
last=target;
quantum=target > last ? -1 : 1;
for ( ; target != (last+quantum); target+=quantum)
{
for (next=image; next; next=next->next)
{
Image
*clone_image;

if (next->scene != target)
continue;
/*
Clone this subimage.
*/
clone_image=CloneImage(next,0,0,True,exception);
if (clone_image == (Image *) NULL)
break;
if (subimages == (Image *) NULL)
{
subimages=clone_image;
continue;
}
subimages->next=clone_image;
subimages->next->previous=subimages;
subimages=subimages->next;
}
}
}
DestroyImages(image);
image=(Image *) NULL;
if (subimages == (Image *) NULL)
ThrowException(exception,OptionWarning,
"Subimage specification returns no images",clone_info->filename);
while (subimages->previous != (Image *) NULL)
subimages=subimages->previous;
image=subimages;
}
else
if ((clone_info->subrange != 0) && (image->next != (Image *) NULL))
{
int
retain;

/*
User specified subimages (e.g. image.miff[1]).
*/
for ( ; ; )
{
retain=(image->scene >= clone_info->subimage) &&
(image->scene <= (clone_info->subimage+clone_info->subrange-1));
if (image->next != (Image *) NULL)
{
image=image->next;
if (!retain)
DestroyImage(image->previous);
continue;
}
if (image->previous != (Image *) NULL)
{
image=image->previous;
if (!retain)
DestroyImage(image->next);
break;
}
if (!retain)
{
DestroyImage(image);
image=(Image *) NULL;
}
break;
}
if (image == (Image *) NULL)
{
ThrowException(exception,OptionWarning,
"Subimage specification returns no images",clone_info->filename);
DestroyImageInfo(clone_info);
return((Image *) NULL);
}
while (image->previous != (Image *) NULL)
image=image->previous;
}
if (image->status)
{
ThrowException(exception,CorruptImageWarning,
"An error has occurred reading file",clone_info->filename);
DestroyImageInfo(clone_info);
return((Image *) NULL);
}
DestroyBlobInfo(&image->blob);
for (next=image; next; next=next->next)
{
GetBlobInfo(&next->blob);
next->taint=False;
(void) strcpy(next->magick_filename,clone_info->filename);
if (image->temporary)
(void) strcpy(next->filename,clone_info->filename);
if (next->magick_columns == 0)
next->magick_columns=next->columns;
if (next->magick_rows == 0)
next->magick_rows=next->rows;
}
DestroyImageInfo(clone_info);
return(image);
}


I am getting an error (runtime ) in the blocked code.
 
Old 06-18-2009, 11:07 AM   #4
pramod.srk
Member
 
Registered: Feb 2009
Posts: 47

Original Poster
Rep: Reputation: 15
Sorry i should not give the full source code as it is too length ..
Please ignore the rest part of the code :-)
 
Old 06-18-2009, 12:07 PM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Quote:
Originally Posted by pramod.srk View Post
Sorry i should not give the full source code as it is too length ..
Please ignore the rest part of the code :-)
You should also surround your code with code (or php) tags which generate html that doesn't strip out the "extra" blanks. That makes it much more readable.

As to your problem, the assertion you highlighted in bold is, obviously, a check that the pointer is not null. So, when it failed, it's telling you that you have not correctly initialized the values in the structure.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
g_error_copy: assertion `error != NULL' failed chuangsheng Programming 0 06-13-2009 02:08 AM
Deconstructor gives Assertion error? Fredstar Programming 5 05-07-2009 02:47 PM
openldap assertion error -- ldap_parse_result: Assertion `r != ((void *)0)' failed nottings Linux - Server 1 02-19-2009 01:20 AM
Get Assertion Error when installing FC3 st95accord Fedora - Installation 1 04-02-2005 01:22 AM
Compiling Java Assertion error CragStar Linux From Scratch 13 01-21-2003 02:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration