[vlc-commits] mediacodec: fix comparison between signed and unsigned warning

Thomas Guillem git at videolan.org
Tue Oct 14 15:44:58 CEST 2014


vlc | branch: master | Thomas Guillem <tom at gllm.fr> | Tue Oct 14 12:22:04 2014 +0200| [4e32abb170e6c5ee96247f56ba3494bb0818b574] | committer: Jean-Baptiste Kempf

mediacodec: fix comparison between signed and unsigned warning

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4e32abb170e6c5ee96247f56ba3494bb0818b574
---

 modules/codec/omxil/android_mediacodec.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index df2c2ca..f3582f0 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -986,7 +986,12 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
         jobject buf = (*env)->GetObjectArrayElement(env, p_sys->input_buffers, index);
         jsize size = (*env)->GetDirectBufferCapacity(env, buf);
         uint8_t *bufptr = (*env)->GetDirectBufferAddress(env, buf);
-        if (size > p_block->i_buffer)
+        if (size < 0) {
+            msg_Err(p_dec, "Java buffer has invalid size");
+            p_sys->error_state = true;
+            break;
+        }
+        if ((size_t) size > p_block->i_buffer)
             size = p_block->i_buffer;
         memcpy(bufptr, p_block->p_buffer, size);
 



More information about the vlc-commits mailing list