[vlc-commits] npapi: fix possible crash

Daniel Amm git at videolan.org
Mon Jan 2 20:13:03 CET 2017


npapi-vlc | branch: master | Daniel Amm <da2424 at t-online.de> | Mon Jan  2 20:05:30 2017 +0100| [d6014bde9d66d060cfdee98ce81491c98b123c48] | committer: Jean-Baptiste Kempf

npapi: fix possible crash

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> https://code.videolan.org/videolan/npapi-vlc/commit/d6014bde9d66d060cfdee98ce81491c98b123c48
---

 NEWS                          | 3 +++
 npapi/npruntime/npolibvlc.cpp | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/NEWS b/NEWS
index 7bb1c17..ef2afb7 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@ ActiveX:
  * Allow empty strings for aspectRatio and crop
  * Fix initial volume value for volume attribute
 
+NPAPI:
+ * Fix possible crash in vlc.playlist.add()
+
 
 Changes between VLC plugins 2.2.2 and 2.2.4:
 --------------------------------------------
diff --git a/npapi/npruntime/npolibvlc.cpp b/npapi/npruntime/npolibvlc.cpp
index 820c638..e2da795 100644
--- a/npapi/npruntime/npolibvlc.cpp
+++ b/npapi/npruntime/npolibvlc.cpp
@@ -1133,6 +1133,10 @@ void LibvlcPlaylistNPObject::parseOptions(NPObject *obj, int *i_options,
     NPIdentifier propId = NPN_GetStringIdentifier("length");
     if( NPN_GetProperty(_instance, obj, propId, value) )
     {
+        /* Check if result is valid (because we don't use NPN_HasProperty, the result can be void) */
+        if( !value.is<int>() )
+            return;
+
         int count = value;
 
         if( count )



More information about the vlc-commits mailing list