History log of /dalvik/dx/junit-tests/com/android/dx/util/ByteArrayAnnotatedOutputTest.java
Revision Date Author Comments
ff292cd2d08a9a17937783d23b435d03aa592f92 14-Sep-2017 Ivan Gavrilovic <gavra@google.com> Reuse the underlying byte array for ByteArray

Reuse the byte array for dex file output.

When calculating signature and checksum for a DEX
file, consider the size of the DEX file, instead of
the array. An array bigger than the file can be
allocated, and this would lead to wrong signature
and checksum calculation.

Because we reuse the output array
between seprate dx invocations, we
must write zeros to array. Otherwise, we might
end up picking up the output from
previous invocation.

The BaseDumper now tracks the number of read
bytes instead of the position.

Test: existing
Change-Id: I17126cfc02330bb459ae48be781e83ea997e4137
f30081f46ec1a5c863531730d068c761ca7a7ca4 14-Sep-2017 Orion Hodson <oth@google.com> Revert "Provide APIs to allow reusing the passed buffer."

This reverts commit d67961b03525d8b58cfa55d33c8ca669dc16f563.

Reason for revert: Fails 18 tests in dx/tests/run-all-tests

Change-Id: I98db656689d6330ddf56a5661a49a19315b8b901
d67961b03525d8b58cfa55d33c8ca669dc16f563 17-Jun-2017 Jerome Dochez <jedo@google.com> Provide APIs to allow reusing the passed buffer.

no functional changes.

Test: existing.

Change-Id: I30fbf02b92e804238807b4c98c3536c5c4c60ca4

Consider DEX size for signature and checksum

When calculating signature and checksum for a DEX
file, consider the size of the DEX file, instead of
the array. An array bigger than the file can be
allocated, and this would lead to wrong signature
and checksum calculation.

Test: manually verified, existing tests
Change-Id: I0b6ae946cca7c0e71bb5e1f0ecbe209b91347c9d

Write zeros to byte array output

Because we reuse the output array
between seprate dx invocations, we
must write zeros to array. Otherwise, we might
end up picking up the output from
previous invocation.

Dx had an assumption that a new output
array is always allocated, and it was
a performance optimization not to write
zeros out. That does not apply any more.

BUG=65363025
Test: ByteArrayAnnotatedOutputTest

Change-Id: I984076e8078f9ed977f10cacb9b1b135b1d6358e