From 88e6b341cb0b7c2023d6baa75f85eb58ebcaedd0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 30 Nov 2010 23:41:15 +0000 Subject: Gracefully handle out of range event URI mappings. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2680 a436a847-0d15-0410-975c-d299462d15a1 --- src/shared/LV2URIMap.cpp | 4 ++++ src/shared/LV2URIMap.hpp | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'src') 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 + #include + #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" -- cgit v1.2.1