[SCM] Multi-format 1D/2D barcode image processing library branch, upstream, updated. 24d4480bc48cf9eabf7b2bd2f528248b0e458809
srowen
srowen at 59b500cc-1b3d-0410-9834-0bbf25fbcc57
Wed Aug 4 01:31:56 UTC 2010
The following commit has been merged in the upstream branch:
commit cce6f2a796765554458e0db234b44056323a10de
Author: srowen <srowen at 59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Date: Tue Jun 8 22:39:49 2010 +0000
Better handling of empty/incomplete content stream
git-svn-id: http://zxing.googlecode.com/svn/trunk@1417 59b500cc-1b3d-0410-9834-0bbf25fbcc57
diff --git a/android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java b/android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java
index 5d1bbf8..ab2e421 100755
--- a/android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java
+++ b/android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java
@@ -139,8 +139,16 @@ final class QRCodeEncoder {
Uri uri = (Uri)intent.getExtras().getParcelable(Intent.EXTRA_STREAM);
InputStream stream = activity.getContentResolver().openInputStream(uri);
int length = stream.available();
+ if (length <= 0) {
+ Log.w(TAG, "Content stream is empty");
+ return false;
+ }
byte[] vcard = new byte[length];
int bytesRead = stream.read(vcard, 0, length);
+ if (bytesRead < length) {
+ Log.w(TAG, "Unable to fully read available bytes from content stream");
+ return false;
+ }
String vcardString = new String(vcard, 0, bytesRead, "UTF-8");
Log.d(TAG, "Encoding share intent content:");
Log.d(TAG, vcardString);
--
Multi-format 1D/2D barcode image processing library
More information about the Pkg-google-commits
mailing list