]> git.sesse.net Git - vlc/commitdiff
mediacodec: fix comparison between signed and unsigned warning
authorThomas Guillem <tom@gllm.fr>
Tue, 14 Oct 2014 10:22:04 +0000 (12:22 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 14 Oct 2014 13:44:41 +0000 (15:44 +0200)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/codec/omxil/android_mediacodec.c

index df2c2cacef3e348b2f4f9b33c88e1e61c3b4a597..f3582f077a3f8d5b716f11c6c3f00f2f910df467 100644 (file)
@@ -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);