Merge "Check for OOM in BitmapFactory's getMimeTypeString()." into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e9a935f6b6
@@ -77,8 +77,10 @@ jstring getMimeTypeString(JNIEnv* env, SkImageDecoder::Format format) {
|
||||
}
|
||||
}
|
||||
|
||||
jstring jstr = 0;
|
||||
if (NULL != cstr) {
|
||||
jstring jstr = NULL;
|
||||
if (cstr != NULL) {
|
||||
// NOTE: Caller should env->ExceptionCheck() for OOM
|
||||
// (can't check for NULL as it's a valid return value)
|
||||
jstr = env->NewStringUTF(cstr);
|
||||
}
|
||||
return jstr;
|
||||
@@ -330,10 +332,13 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding
|
||||
|
||||
// update options (if any)
|
||||
if (options != NULL) {
|
||||
jstring mimeType = getMimeTypeString(env, decoder->getFormat());
|
||||
if (env->ExceptionCheck()) {
|
||||
return nullObjectReturn("OOM in getMimeTypeString()");
|
||||
}
|
||||
env->SetIntField(options, gOptions_widthFieldID, scaledWidth);
|
||||
env->SetIntField(options, gOptions_heightFieldID, scaledHeight);
|
||||
env->SetObjectField(options, gOptions_mimeFieldID,
|
||||
getMimeTypeString(env, decoder->getFormat()));
|
||||
env->SetObjectField(options, gOptions_mimeFieldID, mimeType);
|
||||
}
|
||||
|
||||
// if we're in justBounds mode, return now (skip the java bitmap)
|
||||
|
||||
Reference in New Issue
Block a user