square/picasso — pull request #189 by Ponyets (2013-08-21 02:15:35+00:00)
Title: Decode bytearray no stream to avoid crash when decode webp

I know that read stream into a byte array may reduce performance, but it seems the only to correctly decode webp without crash.

p.s the crash log
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/takju/maguro:4.3/JWR66V/737497:user/release-keys'
Revision: '9'
pid: 21065, tid: 21100, name: GAThread >>> com.sankuai.meituan <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr a4d5ce96
r0 702f350d r1 00000028 r2 00000001 r3 a4d5ce92
r4 00000198 r5 00000000 r6 5a5a9890 r7 c0000000
r8 00000004 r9 00000000 sl 000097af fp 00000000
ip 702f350d sp 5f05a9b0 lr 4010e599 pc 4010e978 cpsr 900f0030
d0 0000000000000000 d1 0000000000000000
d2 0000000000000000 d3 0000000000000000
d4 df20344724810cfc d5 a78b7234428be6c6
d6 397dbc2f09941410 d7 0000040055efa3c7
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 4040000000000000 d17 4040000000000000
d18 0000000000000004 d19 412e848000000000
d20 4156e36000000000 d21 412e848000000000
d22 3ff0000000000000 d23 412e848000000000
d24 4024000000000000 d25 0000000000000005
d26 4000000000000000 d27 547d42aea2879f2e
d28 0707070703030303 d29 0003000000030000
d30 4059000000000000 d31 4024000000000000
scr 60000014
backtrace:
#00 pc 0000f978 /system/lib/libc.so (dlmalloc+1043)
#01 pc 0000d9ab /system/lib/libc.so (malloc+10)
#02 pc 0007707d /system/lib/libcrypto.so
#03 pc 00077517 /system/lib/libcrypto.so (CRYPTO_malloc+66)
#04 pc 0006cdf1 /system/lib/libcrypto.so (ERR_get_state+52)
#05 pc 0006d05d /system/lib/libcrypto.so (ERR_clear_error+4)
#06 pc 000191f5 /system/lib/libssl.so (ssl3_connect+32)
#07 pc 00024ba1 /system/lib/libssl.so (SSL_do_handshake+72)
#08 pc 00028def /system/lib/libjavacore.so
#09 pc 0001dc4c /system/lib/libdvm.so (dvmPlatformInvoke+112)
#10 pc 0004decf /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#11 pc 00027060 /system/lib/libdvm.so
#12 pc 0002b5ec /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#13 pc 0005ff21 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)
#14 pc 0005ff4b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#15 pc 00054ccb /system/lib/libdvm.so
#16 pc 0000ca58 /system/lib/libc.so (__thread_entry+72)
#17 pc 0000cbd4 /system/lib/libc.so (pthread_create+208)
stack:
5f05a970 10fce9d7
5f05a974 6a523b25
5f05a978 d4b89d83
5f05a97c 4e2e0ff1 /dev/ashmem/dalvik-heap (deleted)
5f05a980 9884715f
5f05a984 f2dac3ad
5f05a988 5c40250b /system/framework/framework-res.apk
5f05a98c d6b69779
5f05a990 5b4911a5 /system/lib/libjavacore.so
5f05a994 00000000
5f05a998 00000190
5f05a99c 00000000
5f05a9a0 00000000
5f05a9a4 40ac7d98 /system/lib/libcrypto.so
5f05a9a8 df0027ad
5f05a9ac 00000000
#00 5f05a9b0 40ac7d98 /system/lib/libcrypto.so
5f05a9b4 00000001
5f05a9b8 40af46d0 /system/lib/libcrypto.so
5f05a9bc 40a74943 /system/lib/libcrypto.so (CRYPTO_add_lock+66)
5f05a9c0 40af46d0 /system/lib/libcrypto.so
5f05a9c4 00000190
5f05a9c8 00000000
5f05a9cc 000003fb
5f05a9d0 40ac7d98 /system/lib/libcrypto.so
5f05a9d4 40aeee58 /system/lib/libcrypto.so
5f05a9d8 00000000
5f05a9dc 5205f698
5f05a9e0 00000000
5f05a9e4 4010c9ad /system/lib/libc.so (malloc+12)
#01 5f05a9e8 40af1ba0 /system/lib/libcrypto.so
5f05a9ec 40a9507f /system/lib/libcrypto.so
#02 5f05a9f0 40a95075 /system/lib/libcrypto.so
5f05a9f4 40a95519 /system/lib/libcrypto.so (CRYPTO_malloc+68)
memory near r0:
702f34ec ffffffff ffffffff ffffffff ffffffff
702f34fc ffffffff ffffffff ffffffff ffffffff
702f350c ffffffff ffffffff ffffffff ffffffff
702f351c ffffffff ffffffff ffffffff ffffffff
702f352c ffffffff ffffffff ffffffff ffffffff
702f353c ffffffff ffffffff ffffffff ffffffff
702f354c ffffffff ffffffff ffffffff ffffffff
702f355c ffffffff ffffffff ffffffff ffffffff
702f356c ffffffff ffffffff ffffffff ffffffff
702f357c ffffffff ffffffff ffffffff ffffffff
702f358c ffffffff ffffffff ffffffff ffffffff
702f359c ffffffff ffffffff ffffffff ffffffff
702f35ac ffffffff ffffffff ffffffff ffffffff
702f35bc ffffffff ffffffff ffffffff ffffffff
702f35cc ffffffff ffffffff ffffffff ffffffff
702f35dc ffffffff ffffffff ffffffff ffffffff
memory near r3:
a4d5ce70 ffffffff ffffffff ffffffff ffffffff
a4d5ce80 ffffffff ffffffff ffffffff ffffffff
a4d5ce90 ffffffff ffffffff ffffffff ffffffff
a4d5cea0 ffffffff ffffffff ffffffff ffffffff
a4d5ceb0 ffffffff ffffffff ffffffff ffffffff
a4d5cec0 ffffffff ffffffff ffffffff ffffffff
a4d5ced0 ffffffff ffffffff ffffffff ffffffff
a4d5cee0 ffffffff ffffffff ffffffff ffffffff
a4d5cef0 ffffffff ffffffff ffffffff ffffffff
a4d5cf00 ffffffff ffffffff ffffffff ffffffff
a4d5cf10 ffffffff ffffffff ffffffff ffffffff
a4d5cf20 ffffffff ffffffff ffffffff ffffffff
a4d5cf30 ffffffff ffffffff ffffffff ffffffff
a4d5cf40 ffffffff ffffffff ffffffff ffffffff
a4d5cf50 ffffffff ffffffff ffffffff ffffffff
a4d5cf60 ffffffff ffffffff ffffffff ffffffff
memory near r6:
5a5a9870 00000000 00000000 00000000 00000000
5a5a9880 00000000 00000000 00000000 00000000
5a5a9890 00000000 000001c1 5a5a9890 5a5a9890
5a5a98a0 5a85d050 00000000 4014a128 00000001
5a5a98b0 00000000 00000000 00000000 00000000
5a5a98c0 00000000 00000000 00000000 00000000
5a5a98d0 00000000 00000000 00000000 00000000
5a5a98e0 00000000 00000000 00000000 00000000
5a5a98f0 00000000 00000000 00000000 00000000
5a5a9900 00000000 00000000 00000000 00000000
5a5a9910 00000000 00000000 00000000 00000000
5a5a9920 00000000 00000000 00000000 00000000
5a5a9930 00000000 00000000 00000000 00000000
5a5a9940 00000000 00000000 00000000 00000000
5a5a9950 00000000 00000000 00000000 00000000
5a5a9960 00000000 00000000 00000000 00000000
memory near sl:
0000978c ffffffff ffffffff ffffffff ffffffff
0000979c ffffffff ffffffff ffffffff ffffffff
000097ac ffffffff ffffffff ffffffff ffffffff
000097bc ffffffff ffffffff ffffffff ffffffff
000097cc ffffffff ffffffff ffffffff ffffffff
000097dc ffffffff ffffffff ffffffff ffffffff
000097ec ffffffff ffffffff ffffffff ffffffff
000097fc ffffffff ffffffff ffffffff ffffffff
0000980c ffffffff ffffffff ffffffff ffffffff
0000981c ffffffff ffffffff ffffffff ffffffff
0000982c ffffffff ffffffff ffffffff ffffffff
0000983c ffffffff ffffffff ffffffff ffffffff
0000984c ffffffff ffffffff ffffffff ffffffff
0000985c ffffffff ffffffff ffffffff ffffffff
0000986c ffffffff ffffffff ffffffff ffffffff
0000987c ffffffff ffffffff ffffffff ffffffff
memory near ip:
702f34ec ffffffff ffffffff ffffffff ffffffff
702f34fc ffffffff ffffffff ffffffff ffffffff
702f350c ffffffff ffffffff ffffffff ffffffff
702f351c ffffffff ffffffff ffffffff ffffffff
702f352c ffffffff ffffffff ffffffff ffffffff
702f353c ffffffff ffffffff ffffffff ffffffff
702f354c ffffffff ffffffff ffffffff ffffffff
702f355c ffffffff ffffffff ffffffff ffffffff
702f356c ffffffff ffffffff ffffffff ffffffff
702f357c ffffffff ffffffff ffffffff ffffffff
702f358c ffffffff ffffffff ffffffff ffffffff
702f359c ffffffff ffffffff ffffffff ffffffff
702f35ac ffffffff ffffffff ffffffff ffffffff
702f35bc ffffffff ffffffff ffffffff ffffffff
702f35cc ffffffff ffffffff ffffffff ffffffff
702f35dc ffffffff ffffffff ffffffff ffffffff
memory near sp:
5f05a990 5b4911a5 00000000 00000190 00000000
5f05a9a0 00000000 40ac7d98 df0027ad 00000000
5f05a9b0 40ac7d98 00000001 40af46d0 40a74943
5f05a9c0 40af46d0 00000190 00000000 000003fb
5f05a9d0 40ac7d98 40aeee58 00000000 5205f698
5f05a9e0 00000000 4010c9ad 40af1ba0 40a9507f
5f05a9f0 40a95075 40a95519 00000190 40ac7d98
5f05aa00 00000000 5205f5c0 39d00005 34600009
5f05aa10 5a381fa8 40a8adf5 00000000 5205fad8
5f05aa20 00000000 5205fad8 00ca1add 70548794
5f05aa30 83a4b26b d2a10cb7 15270d76 30b69060
5f05aa40 4dbc99bd 2191ed16 4d7cc62e d7de8a46
5f05aa50 92ddc6c5 744db303 afacf16e f7d8d615
5f05aa60 fd5cc9a9 7ec0a0e0 e2e40e5e 8413641a
5f05aa70 815d01ce 54b2c8ff 05f39b0d f64d90f4
5f05aa80 89af943c 0a98005a 39b84a76 4ac8d00d
code around pc:
4010e958 f853447b b3533020 d0032a1f f1c60856
4010e968 e0000719 f04f2700 fa040c00 4666f707
4010e978 f0206858 1b000007 d2034288 461e4601
4010e988 d0572800 78d7ea4f f1086958 f8530804
4010e998 b1103028 d1014298 4660e002 4684b113
4010e9a8 e7e5007f 28004603 2e00d144 f06fd142
4010e9b8 fa030301 ea12f202 d02a030a ea06425e
4010e9c8 1e430003 f0020b1a fa230610 0943f006
4010e9d8 0c08f003 f20cfa20 08904466 0304f000
4010e9e8 f203fa22 0c03eb06 f0060856 fa220002
4010e9f8 4484f200 0340f3c2 f603fa22 0003eb0c
4010ea08 373cf8df 324c1982 447b2600 3022f853
4010ea18 461ee010 6858e00e 0c07f020 020cebc4
4010ea28 bf28428a 6919460a 461ebf38 6959b901
4010ea38 4611460b d1ee2b00 f0002e00 f8df8123
4010ea48 44780704 1b136882 f0804299 f8d0811b
code around lr:
4010e578 f8dfff07 44791b94 21bcf8d1 d4020793
4010e588 d9092cf4 f501e1a6 260070e0 ed32f7fe
4010e598 f0412800 e7f3807c d9032c0a f024340b
4010e5a8 e0000407 f8df2410 08e23b68 6818447b
4010e5b8 f102fa20 078e9003 f001d021 f0840401
4010e5c8 18b10601 04c1eb03 68a63428 429468b2
4010e5d8 2201d106 fc01fa02 000cea20 e00c6018
4010e5e8 42826918 68d3d305 d10242b3 60a260d4
4010e5f8 f8dfe003 44780b20 00c8e0df 689de358
4010e608 f24042ac 2900833f f04fd074 fa000001
4010e618 fa01f602 fa06f202 4277f600 0c06ea47
4010e628 0602ea0c ea014271 1e7a0706 f0060b16
4010e638 fa220110 0957f201 0c08f007 f60cfa22
4010e648 08b24461 0c04f002 f60cfa26 070ceb01
4010e658 f100fa26 0202f001 f602fa26 0c02eb07
4010e668 0140f3c6 f201fa26 0701eb0c eb0318bf
memory map around fault addr a4d5ce96:
63c09000-63f5c000 rw- /dev/pvrsrvkm
(no map for address)
bef93000-befb4000 rw- [stack]