From 180ac5eb9ee6ac68c3f9bbb33eb85dc482811d94 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Fri, 9 May 2014 14:18:08 +0200 Subject: [PATCH] Fixed AMF parser segfaulting on attempted retrieval of non-existant data. --- lib/amf.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/amf.cpp b/lib/amf.cpp index 65c67200..9b75da02 100644 --- a/lib/amf.cpp +++ b/lib/amf.cpp @@ -48,6 +48,9 @@ void AMF::Object::addContent(AMF::Object c){ /// Returns AMF::AMF0_DDV_CONTAINER of indice "error" if no object is held at this indice. /// \param i The indice of the object in this container. AMF::Object* AMF::Object::getContentP(int i){ + if (i >= contents.size()){ + return 0; + } return &contents.at(i); }