OPP: Check file size before send to prevent crash

Use case :
1. Send large file to dut (Above 4 GB)
Failure:
Crash in com.android.bluetooth.
Process: com.android.bluetooth
java.lang.IllegalArgumentException: Length must be
   between 0 and 0xFFFFFFFF
at javax.obex.HeaderSet.setHeader(HeaderSet.java:333)
at com.android.bluetooth.opp.BluetoothOppObexClientSession$ClientThread
   .sendFile(BluetoothOppObexClientSession.java:411)
at com.android.bluetooth.opp.BluetoothOppObexClientSession$ClientThread
    .doSend(BluetoothOppObexClientSession.java:337)

Root cause :
Largest length in OBEX message header is unsigned 4 bytes, so actual
file length (4 GB) cannot be written into Obex header which leads
to exception in OBEX code.

Fix :
Add length check before push file and skip sendfile if length is above
4GB to prevent crash.

Change-Id: I9066fb7456d85fdc197fe21fed26fb2bb89ff09e
3 files changed
tree: 99f482ddbf480d6dfd4d98aad678af05509a53a7
  1. android/