New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 603124 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

[Cronet] UploadDataProviders.create(byte[], offset, count) is broken when offset != 0

Project Member Reported by xunji...@chromium.org, Apr 13 2016

Issue description

[Moving Internal bug: 28116260 to crbug.com]

ByteBuffer.wrap(data, offset, length) returns a ByteBuffer with array offset 0 and position offset. ByteBufferUploadDataProvider.rewind resets the position to 0, which is incorrect in this case. The buffer should be sliced before passing it to ByteBufferUploadProvider.



 

Comment 1 by mef@chromium.org, Apr 26 2016

Cc: clm@google.com
Labels: FixIt-Net
Status: Available (was: Untriaged)
Owner: xunji...@chromium.org
Status: Assigned (was: Available)
Status: Started (was: Assigned)
Thanks for identifying the problem and suggesting a fix!

CL in review: https://codereview.chromium.org/1983123002/
Project Member

Comment 4 by bugdroid1@chromium.org, May 17 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e3db5466956f058d7a69c33452a543a15261080d

commit e3db5466956f058d7a69c33452a543a15261080d
Author: xunjieli <xunjieli@chromium.org>
Date: Tue May 17 19:40:11 2016

Fix UploadDataProviders.create(byte[], offset, count)

This CL makes UploadDataProviders.create(byte[], offset, count) create a ByteBuffer
with position 0, so when rewind() is called, resetting the
position back to 0 doesn't break things.

BUG= 603124 

Review-Url: https://codereview.chromium.org/1983123002
Cr-Commit-Position: refs/heads/master@{#394193}

[modify] https://crrev.com/e3db5466956f058d7a69c33452a543a15261080d/components/cronet/android/api/src/org/chromium/net/UploadDataProviders.java
[modify] https://crrev.com/e3db5466956f058d7a69c33452a543a15261080d/components/cronet/android/test/javatests/src/org/chromium/net/UploadDataProvidersTest.java

Status: Fixed (was: Started)
Project Member

Comment 6 by bugdroid1@chromium.org, May 18 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e18f28140777747260eabb021831c59ee03bc319

commit e18f28140777747260eabb021831c59ee03bc319
Author: xunjieli <xunjieli@chromium.org>
Date: Wed May 18 12:43:20 2016

[Cronet] add a test assertion in UploadDataProvidersTest.java

This CL adds a test assertion in UploadDataProvidersTest.java to make sure
getLength() is correct when UploadDataProvider is constructed with a byte array
with an offset.

BUG= 603124 

Review-Url: https://codereview.chromium.org/1991453002
Cr-Commit-Position: refs/heads/master@{#394392}

[modify] https://crrev.com/e18f28140777747260eabb021831c59ee03bc319/components/cronet/android/test/javatests/src/org/chromium/net/UploadDataProvidersTest.java

Sign in to add a comment