fresco
fresco copied to clipboard
Improve bytearray handling
NewByteArray can fail and return null, consider checking before using the returned value as array https://github.com/facebook/fresco/blob/2ae15501ad3fc132528f100990b9c06de4846e3a/imagepipeline/src/main/jni/imagepipeline/jpeg/jpeg_stream_wrappers.cpp#L135
Thanks for the suggestions! Feel free to submit a pull request!
Hi @oprisnik I'm trying to work on this issue, may I know what behaviour that we expect when NewByteArray return null? Is run safeThrow enough?
Hey! Sorry for the delayed response. I guess throwing should be fine yes. We already throw a couple lines below when the other buffer is null:
if (dest->buffer == NULL) {
jpegSafeThrow(
(j_common_ptr) cinfo,
"Failed to allcoate memory for byte buffer.");
}
@oprisnik I cannot find this path fresco/imagepipeline/src/main/jni/imagepipeline/jpeg/jpeg_stream_wrappers.cpp
Is this issue still valid? If yes, then where is jpeg_stream_wrappers.cpp
moved?
Hey! Native code was moved to https://github.com/facebook/fresco/blob/a6b47b94b229ea8549ea4bc70bd22970e97ba465/native-imagetranscoder/src/main/jni/native-imagetranscoder/jpeg/jpeg_stream_wrappers.cpp
should this issue still be open?