summaryrefslogtreecommitdiff
path: root/src/ntriples_parse.c
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2011-11-12 12:52:40 -0800
committerDave Beckett <dave@dajobe.org>2011-11-12 12:52:40 -0800
commitb97bf7a5739e8e06d916ce9048446c3a6f11e944 (patch)
tree427a7952d86e3a0a1eb7ae50484e57f93f388741 /src/ntriples_parse.c
parent63d9c4e3e6339760899105be096f79583be8f39e (diff)
downloadraptor-b97bf7a5739e8e06d916ce9048446c3a6f11e944.tar.gz
Check for error return for all raptor_unicode_utf8_string_get_char() calls
Fixes Issue #000481 http://bugs.librdf.org/mantis/view.php?id=481
Diffstat (limited to 'src/ntriples_parse.c')
-rw-r--r--src/ntriples_parse.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ntriples_parse.c b/src/ntriples_parse.c
index 3895ff9c..c6b4b9fb 100644
--- a/src/ntriples_parse.c
+++ b/src/ntriples_parse.c
@@ -379,9 +379,9 @@ raptor_ntriples_term(raptor_parser* rdf_parser,
if(allow_utf8) {
if(c > 0x7f) {
/* just copy the UTF-8 bytes through */
- size_t unichar_len;
+ int unichar_len;
unichar_len = raptor_unicode_utf8_string_get_char(p - 1, 1 + *lenp, NULL);
- if(unichar_len > *lenp) {
+ if(unichar_len < 0 || RAPTOR_GOOD_CAST(size_t, unichar_len) > *lenp) {
raptor_parser_error(rdf_parser, "UTF-8 encoding error at character %d (0x%02X) found.", c, c);
/* UTF-8 encoding had an error or ended in the middle of a string */
return 1;
@@ -393,8 +393,8 @@ raptor_ntriples_term(raptor_parser* rdf_parser,
p += unichar_len;
(*lenp) -= unichar_len;
- rdf_parser->locator.column += RAPTOR_GOOD_CAST(int, unichar_len);
- rdf_parser->locator.byte += RAPTOR_GOOD_CAST(int, unichar_len);
+ rdf_parser->locator.column += unichar_len;
+ rdf_parser->locator.byte += unichar_len;
continue;
}
} else if(!IS_ASCII_PRINT(c)) {