X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fosdn%2Fgokigen%2Fa01d%2Fcamera%2Fptpip%2Fwrapper%2Fcommand%2FPtpIpCommandPublisher.java;h=e1672bbebf120cd3e4b413e950a60bd928fd285e;hb=2eb5dec7d293c16ef3919e55a7ce316af39a1499;hp=23f4b9c583872462cab5af839ed3add6bf591875;hpb=4ad84fade663f8eebc71ea98e87e29258fb7c554;p=gokigen%2FA01d.git diff --git a/app/src/main/java/net/osdn/gokigen/a01d/camera/ptpip/wrapper/command/PtpIpCommandPublisher.java b/app/src/main/java/net/osdn/gokigen/a01d/camera/ptpip/wrapper/command/PtpIpCommandPublisher.java index 23f4b9c..e1672bb 100644 --- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ptpip/wrapper/command/PtpIpCommandPublisher.java +++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ptpip/wrapper/command/PtpIpCommandPublisher.java @@ -472,6 +472,14 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm int target_length = parseDataLength(byte_array, read_bytes); int received_length = read_bytes; + if (target_length <= 0) + { + // 受信サイズ異常の場合... + Log.v(TAG, " WRONG LENGTH. : " + target_length); + callback.receivedMessage(id, null); + return (false); + } + // 一時的な処理 if (callback != null) { @@ -530,12 +538,10 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm Log.v(TAG, " --- receive_multi : " + id + " (" + read_bytes + ") [" + maxRetryCount + "] " + receive_message_buffer_size + " (" + received_length + ") "); callback.receivedMessage(id, null); } - System.gc(); } catch (Throwable e) { e.printStackTrace(); - System.gc(); } return (false); } @@ -543,15 +549,15 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm private int parseDataLength(byte[] byte_array, int read_bytes) { int lenlen = 0; - int packetType = 0; + //int packetType = 0; try { if ((read_bytes > 20)&&((int) byte_array[4] == 0x09)) { lenlen = ((((int) byte_array[15]) & 0xff) << 24) + ((((int) byte_array[14]) & 0xff) << 16) + ((((int) byte_array[13]) & 0xff) << 8) + (((int) byte_array[12]) & 0xff); - packetType = (((int)byte_array[16]) & 0xff); + //packetType = (((int)byte_array[16]) & 0xff); } - Log.v(TAG, " --- parseDataLength() length: " + lenlen + " TYPE: " + packetType + " read_bytes: " + read_bytes); + //Log.v(TAG, " --- parseDataLength() length: " + lenlen + " TYPE: " + packetType + " read_bytes: " + read_bytes); } catch (Exception e) {