[redland-dev] [Rasqal RDF Query Library 0000567]: Segfault based on documentation recommendation

Mantis Bug Tracker mantis-bug-sender at librdf.org
Wed Feb 19 11:22:43 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.librdf.org/mantis/view.php?id=567 
====================================================================== 
Reported By:                ewpatton
Assigned To:                
====================================================================== 
Project:                    Rasqal RDF Query Library
Issue ID:                   567
Category:                   documentation
Reproducibility:            always
Severity:                   crash
Priority:                   low
Status:                     new
Query Language:              
====================================================================== 
Date Submitted:             2014-02-19 16:22
Last Modified:              2014-02-19 16:22
====================================================================== 
Summary:                    Segfault based on documentation recommendation
Description: 
According to the documentation for rasqal_new_query:
"A query language can be named or identified by a URI, either of which is
optional. The default query language will be used if both are NULL"

However, when doing this there is a segfault in libc.so in strncmp. This is
caused by rasqal_new_query calling rasqal_sparql_query_language_init with name =
NULL, and rasqal_sparql_query_language_init does not check if the name is null
before passing it to strncmp. Passing a valid value listed in that function
prevents the crash, but is incompatible with the claim that name can be NULL.

Steps to Reproduce: 
Call rasqal_new_query with a valid rasqal_world and the second and third
parameters as NULL, e.g.

int main( int argc, char *argv[] ) {
  rasqal_world *world = rasqal_new_world();
  rasqal_query *query = rasqal_new_query(world, NULL, NULL);
  /* segfault before this line in libc.so */
  printf("Hello world!\n");
  return 0;
}

Additional Information: 
I categorized this as documentation because the documentation is wrong. However,
it may make more sense for there to be a check inserted into
rasqal_sparql_query_language_init for NULL (and assume the latest SPARQL
standard) to bring the code in line with the documentation's claims.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-02-19 16:22 ewpatton       New Issue                                    
======================================================================



More information about the redland-dev mailing list