summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2014-11-01 20:31:17 -0700
committerDave Beckett <dave@dajobe.org>2014-11-01 20:31:17 -0700
commit80da44fe63872fc48fcac14cd5911e45e3a69bbf (patch)
treeac0c07612feedddcc84d6e35597885536fbe19b4
parentb513d11bc39bb8abb247c457e54ed09d80650222 (diff)
downloadraptor-80da44fe63872fc48fcac14cd5911e45e3a69bbf.tar.gz
Remove raptor_turtle_check_uri_string() which is at wrong level.
Needs to be checked in earlier lexing so e.g. illegal escapes in URIs such as \b are found. For example.
-rw-r--r--src/raptor_internal.h1
-rw-r--r--src/raptor_ntriples.c5
-rw-r--r--src/turtle_common.c19
-rw-r--r--src/turtle_lexer.l18
4 files changed, 4 insertions, 39 deletions
diff --git a/src/raptor_internal.h b/src/raptor_internal.h
index 9c989c83..95433d27 100644
--- a/src/raptor_internal.h
+++ b/src/raptor_internal.h
@@ -1233,7 +1233,6 @@ typedef void (*raptor_simple_message_handler)(void *user_data, const char *messa
/* turtle_common.c */
RAPTOR_INTERNAL_API int raptor_stringbuffer_append_turtle_string(raptor_stringbuffer* stringbuffer, const unsigned char *text, size_t len, int delim, raptor_simple_message_handler error_handler, void *error_data);
-RAPTOR_INTERNAL_API int raptor_turtle_check_uri_string(unsigned char *string);
/* raptor_abbrev.c */
diff --git a/src/raptor_ntriples.c b/src/raptor_ntriples.c
index e23debd9..5151ceb7 100644
--- a/src/raptor_ntriples.c
+++ b/src/raptor_ntriples.c
@@ -459,11 +459,6 @@ raptor_ntriples_parse_term(raptor_world* world, raptor_locator* locator,
goto fail;
}
- if(!raptor_turtle_check_uri_string(dest)) {
- raptor_log_error_formatted(world, RAPTOR_LOG_LEVEL_ERROR, locator, "URI '%s' contains bad character(s)", dest);
- goto fail;
- }
-
if(1) {
raptor_uri *uri;
diff --git a/src/turtle_common.c b/src/turtle_common.c
index f9e5f91f..97d05cc6 100644
--- a/src/turtle_common.c
+++ b/src/turtle_common.c
@@ -304,22 +304,3 @@ raptor_turtle_expand_name_escapes(unsigned char *name,
/* string gets owned by the stringbuffer after this */
return len;
}
-
-
-int
-raptor_turtle_check_uri_string(unsigned char *string)
-{
- unsigned char c;
-
- if(!string)
- return 0;
-
- while((c = *string++)) {
- if(((c <= 0x20) ||
- c == '<' || c == '>' || c == '"' || c == '{' || c == '}' ||
- c == '|' || c == '^' || c == '`' || c == '\\'))
- return 0;
- }
- return 1;
-}
-
diff --git a/src/turtle_lexer.l b/src/turtle_lexer.l
index 8984a6d8..08bdb62b 100644
--- a/src/turtle_lexer.l
+++ b/src/turtle_lexer.l
@@ -450,11 +450,7 @@ EXPONENT [eE][+-]?[0-9]+
}
uri_string = raptor_stringbuffer_as_string(sb);
- if(!raptor_turtle_check_uri_string(uri_string)) {
- turtle_syntax_error(rdf_parser, "URI '%s' contains bad character(s)", uri_string);
- raptor_free_stringbuffer(sb);
- yyterminate();
- } else if(!*uri_string)
+ if(!*uri_string)
yylval->uri = raptor_uri_copy(rdf_parser->base_uri);
else
yylval->uri = raptor_new_uri_relative_to_base(rdf_parser->world, rdf_parser->base_uri, uri_string);
@@ -499,16 +495,10 @@ EXPONENT [eE][+-]?[0-9]+
YY_FATAL_ERROR_EOF("raptor_stringbuffer_append_turtle_string failed");
}
uri_string = raptor_stringbuffer_as_string(sb);
- if(!raptor_turtle_check_uri_string(uri_string)) {
- turtle_syntax_error(rdf_parser, "URI '%s' contains bad character(s)", uri_string);
+ yylval->uri = raptor_new_uri_relative_to_base(rdf_parser->world, rdf_parser->base_uri, uri_string);
+ if(!yylval->uri) {
raptor_free_stringbuffer(sb);
- yyterminate();
- } else {
- yylval->uri = raptor_new_uri_relative_to_base(rdf_parser->world, rdf_parser->base_uri, uri_string);
- if(!yylval->uri) {
- raptor_free_stringbuffer(sb);
- TURTLE_LEXER_OOM();
- }
+ TURTLE_LEXER_OOM();
}
raptor_free_stringbuffer(sb);
}