[Android] JNI: add wrapper to NewStringUTF for UTF safety

Duncan McNamara git at videolan.org
Thu Jul 29 08:53:45 UTC 2021


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Fri Jul 23 11:07:37 2021 +0200| [9ad8b175e3053f5ea7b49db977fe2cba7435a115] | committer: Duncan McNamara

JNI: add wrapper to NewStringUTF for UTF safety

When calling NewStringUTF with an invalid UTF string it will abort
instead of returning NULL. This wrapper checks the validity of the UTF
string before calling NewStringUTF.

> https://code.videolan.org/videolan/vlc-android/commit/9ad8b175e3053f5ea7b49db977fe2cba7435a115
---

 libvlc/jni/libvlcjni-dialog.c             | 28 ++++++------
 libvlc/jni/libvlcjni-media.c              | 17 +++----
 libvlc/jni/libvlcjni-mediadiscoverer.c    |  4 +-
 libvlc/jni/libvlcjni-mediaplayer.c        | 10 ++---
 libvlc/jni/libvlcjni-rendererdiscoverer.c | 10 ++---
 libvlc/jni/libvlcjni-vlcobject.c          |  2 +-
 libvlc/jni/libvlcjni.c                    |  6 +--
 libvlc/jni/utils.h                        | 31 +++++++++++++
 medialibrary/jni/AndroidMediaLibrary.cpp  | 20 ++++-----
 medialibrary/jni/medialibrary.cpp         |  8 ++--
 medialibrary/jni/utils.cpp                | 74 ++++++++++++++++++++++---------
 medialibrary/jni/utils.h                  |  1 +
 12 files changed, 137 insertions(+), 74 deletions(-)

Diff:   https://code.videolan.org/videolan/vlc-android/commit/9ad8b175e3053f5ea7b49db977fe2cba7435a115


More information about the Android mailing list