[redland-dev] [Raptor RDF Parsing and Serializing Library 0000312]: Ununitialized pointer in example rdfserialize.c causes crash

Mantis Bug Tracker mantis-bug-sender at librdf.org
Mon Sep 28 19:15:12 CEST 2009


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.librdf.org/mantis/view.php?id=312 
====================================================================== 
Reported By:                RubenV
Assigned To:                
====================================================================== 
Project:                    Raptor RDF Parsing and Serializing Library
Issue ID:                   312
Category:                   documentation
Reproducibility:            sometimes
Severity:                   minor
Priority:                   normal
Status:                     new
Parsing/Serializing Syntax:  
====================================================================== 
Date Submitted:             2009-09-28 17:15
Last Modified:              2009-09-28 17:15
====================================================================== 
Summary:                    Ununitialized pointer in example rdfserialize.c
causes crash
Description: 
The example file  rdfserialize.c initializes a triple the following way:

triple=(raptor_statement*)malloc(sizeof(raptor_statement));

That way, it is possible for the triple->object_literal_datatype field to
contain an uninitialized pointer, which causes a crash on line 1431 of
raptor_serialize_rdfxmla.c when it tries to deference this pointer.

The best solution is to use calloc to initialize the triple:

triple=(raptor_statement*)calloc(1, sizeof(raptor_statement));
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-09-28 17:15 RubenV         New Issue                                    
======================================================================



More information about the redland-dev mailing list