LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Error : constitute.c: ReadImage: Assertion `image_info->signature (https://www.linuxquestions.org/questions/programming-9/error-constitute-c-readimage-assertion-%60image_info-signature-733849/)

pramod.srk 06-18-2009 04:40 AM

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

theNbomr 06-18-2009 09:35 AM

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.

pramod.srk 06-18-2009 10:06 AM

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.

pramod.srk 06-18-2009 10:07 AM

Sorry i should not give the full source code as it is too length ..
Please ignore the rest part of the code :-)

PTrenholme 06-18-2009 11:07 AM

Quote:

Originally Posted by pramod.srk (Post 3578462)
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.


All times are GMT -5. The time now is 02:51 AM.