mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-15 12:55:07 +00:00
8029854: Enhance JPEG decodings
Reviewed-by: bae, vadim, mschoene
This commit is contained in:
parent
dcab98765f
commit
c7fe482018
@ -249,6 +249,7 @@ Java_sun_awt_image_GifImageDecoder_parseImage(JNIEnv *env,
|
||||
/* fill the block */
|
||||
len = (*env)->CallIntMethod(env, this, readID,
|
||||
blockh, remain, blockLength + 1);
|
||||
if (len > blockLength + 1) len = blockLength + 1;
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -945,6 +945,7 @@ imageio_fill_input_buffer(j_decompress_ptr cinfo)
|
||||
JPEGImageReader_readInputDataID,
|
||||
sb->hstreamBuffer, 0,
|
||||
sb->bufferLength);
|
||||
if (ret > sb->bufferLength) ret = sb->bufferLength;
|
||||
if ((*env)->ExceptionOccurred(env)
|
||||
|| !GET_ARRAYS(env, data, &(src->next_input_byte))) {
|
||||
cinfo->err->error_exit((j_common_ptr) cinfo);
|
||||
@ -1041,6 +1042,7 @@ imageio_fill_suspended_buffer(j_decompress_ptr cinfo)
|
||||
JPEGImageReader_readInputDataID,
|
||||
sb->hstreamBuffer,
|
||||
offset, buflen);
|
||||
if (ret > buflen) ret = buflen;
|
||||
if ((*env)->ExceptionOccurred(env)
|
||||
|| !GET_ARRAYS(env, data, &(src->next_input_byte))) {
|
||||
cinfo->err->error_exit((j_common_ptr) cinfo);
|
||||
|
||||
@ -289,6 +289,7 @@ sun_jpeg_fill_input_buffer(j_decompress_ptr cinfo)
|
||||
buflen = (*env)->GetArrayLength(env, src->hInputBuffer);
|
||||
ret = (*env)->CallIntMethod(env, src->hInputStream, InputStream_readID,
|
||||
src->hInputBuffer, 0, buflen);
|
||||
if (ret > buflen) ret = buflen;
|
||||
if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
|
||||
cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
|
||||
}
|
||||
@ -349,6 +350,7 @@ sun_jpeg_fill_suspended_buffer(j_decompress_ptr cinfo)
|
||||
}
|
||||
ret = (*env)->CallIntMethod(env, src->hInputStream, InputStream_readID,
|
||||
src->hInputBuffer, offset, buflen);
|
||||
if (ret > buflen) ret = buflen;
|
||||
if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
|
||||
cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
|
||||
}
|
||||
@ -424,6 +426,7 @@ sun_jpeg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
|
||||
ret = (*env)->CallIntMethod(env, src->hInputStream,
|
||||
InputStream_readID,
|
||||
src->hInputBuffer, 0, buflen);
|
||||
if (ret > buflen) ret = buflen;
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user