summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-11-30 23:41:15 +0000
committerDavid Robillard <d@drobilla.net>2010-11-30 23:41:15 +0000
commit88e6b341cb0b7c2023d6baa75f85eb58ebcaedd0 (patch)
treef16cc2f89792ad59f0813617c46bb1260ef3632d /src
parent6e4322bc87a3af604b656e410d48d8bd8673d3b2 (diff)
downloadingen-88e6b341cb0b7c2023d6baa75f85eb58ebcaedd0.tar.gz
ingen-88e6b341cb0b7c2023d6baa75f85eb58ebcaedd0.tar.bz2
ingen-88e6b341cb0b7c2023d6baa75f85eb58ebcaedd0.zip
Gracefully handle out of range event URI mappings.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2680 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/shared/LV2URIMap.cpp4
-rw-r--r--src/shared/LV2URIMap.hpp5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp
index 24bc1611..90582102 100644
--- a/src/shared/LV2URIMap.cpp
+++ b/src/shared/LV2URIMap.cpp
@@ -138,6 +138,10 @@ LV2URIMap::uri_to_id(const char* map,
if (i != _global_to_event.end()) {
return i->second;
} else {
+ if (_global_to_event.size() + 1 > UINT16_MAX) {
+ error << "Event URI " << uri << " ID out of range." << endl;
+ return NULL;
+ }
const uint16_t ev_id = _global_to_event.size() + 1;
assert(_event_to_global.find(ev_id) == _event_to_global.end());
_global_to_event.insert(make_pair(id, ev_id));
diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp
index 894df25f..a4bdb2d8 100644
--- a/src/shared/LV2URIMap.hpp
+++ b/src/shared/LV2URIMap.hpp
@@ -18,10 +18,15 @@
#ifndef INGEN_SHARED_LV2URIMAP_HPP
#define INGEN_SHARED_LV2URIMAP_HPP
+#include <map>
+
#include <boost/utility.hpp>
+
#include "raul/URI.hpp"
+
#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
#include "lv2/lv2plug.in/ns/ext/uri-unmap/uri-unmap.h"
+
#include "ingen-config.h"
#include "LV2Features.hpp"