summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-08 15:59:08 +0000
committerDavid Robillard <d@drobilla.net>2012-03-08 15:59:08 +0000
commit0046d61833ae1f6a7d5d4bff836d20ddbf571df9 (patch)
treefb3cd0aa6825a1033f6bfafa95e65a08694a2e6f
parent8be9efb931773da4afc90ddaa1776387a9cea630 (diff)
downloadsord-0046d61833ae1f6a7d5d4bff836d20ddbf571df9.tar.gz
sord-0046d61833ae1f6a7d5d4bff836d20ddbf571df9.tar.bz2
sord-0046d61833ae1f6a7d5d4bff836d20ddbf571df9.zip
Refuse to intern relative URIs in sord_new_uri*().
Make sord_iter_get_node() tolerate a NULL iterator. git-svn-id: http://svn.drobilla.net/sord/trunk@202 3d64ff67-21c5-427c-a301-fe4f08042e5a
-rw-r--r--ChangeLog1
-rw-r--r--src/sord.c6
-rw-r--r--wscript2
3 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 68fb5f6..f61ad68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ sord (UNRELEASED) unstable; urgency=low
* Take advantage of interning in sord_node_equals()
* Support compilation as C++ under MSVC++.
* Add sord_iter_get_node()
+ * Refuse to intern relative URIs in sord_new_uri*()
-- David Robillard <d@drobilla.net> (UNRELEASED)
diff --git a/src/sord.c b/src/sord.c
index eac5087..2ffa414 100644
--- a/src/sord.c
+++ b/src/sord.c
@@ -424,7 +424,7 @@ sord_iter_get(const SordIter* iter, SordQuad id)
const SordNode*
sord_iter_get_node(const SordIter* iter, SordQuadIndex index)
{
- return ((SordNode**)zix_tree_get(iter->cur))[index];
+ return iter ? ((SordNode**)zix_tree_get(iter->cur))[index] : NULL;
}
bool
@@ -958,6 +958,10 @@ static SordNode*
sord_new_uri_counted(SordWorld* world, const uint8_t* str,
size_t n_bytes, size_t n_chars, bool copy)
{
+ if (!serd_uri_string_has_scheme(str)) {
+ return NULL; // Can't intern relative URIs
+ }
+
SordNode* node = sord_lookup_name(world, str);
if (node) {
if (!copy) {
diff --git a/wscript b/wscript
index 7ee89ba..0b68c52 100644
--- a/wscript
+++ b/wscript
@@ -8,7 +8,7 @@ from waflib.extras import autowaf as autowaf
import waflib.Logs as Logs, waflib.Options as Options
# Version of this package (even if built as a child)
-SORD_VERSION = '0.6.0'
+SORD_VERSION = '0.6.1'
SORD_MAJOR_VERSION = '0'
# Library version (UNIX style major, minor, micro)