[Android] libvlc: fix crash with vlcNewStringUTF

Thomas Guillem git at videolan.org
Tue Aug 10 10:05:09 UTC 2021


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Aug  6 12:42:51 2021 +0200| [6c61e173bf13ffee507c166535d44c70850e7c51] | committer: Nicolas Pomepuy

libvlc: fix crash with vlcNewStringUTF

psz_string can be NULL.

> https://code.videolan.org/videolan/vlc-android/commit/6c61e173bf13ffee507c166535d44c70850e7c51
---

 libvlc/jni/utils.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libvlc/jni/utils.h b/libvlc/jni/utils.h
index dde20d1e5..a03840ca6 100644
--- a/libvlc/jni/utils.h
+++ b/libvlc/jni/utils.h
@@ -119,6 +119,8 @@ struct fields {
 
 static inline jstring vlcNewStringUTF(JNIEnv* env, const char* psz_string)
 {
+    if (psz_string == NULL)
+        return NULL;
     for (int i = 0 ; psz_string[i] != '\0' ; ) {
         uint8_t lead = psz_string[i++];
         uint8_t nbBytes;



More information about the Android mailing list