Issue Details (XML | Word | Printable)

Key: DERBY-121
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: A B
Reporter: Lynh Nguyen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Network Server reading blob/clob data size

Created: 15/Jan/05 11:13 AM   Updated: 04/Jun/05 04:30 PM
Return to search
Component/s: Network Server
Affects Version/s: 10.1.1.0
Fix Version/s: 10.1.1.0

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works derby-121_2.stat 2005-06-03 03:21 AM A B 1 kB
Text File Licensed for inclusion in ASF works derby-121_3.patch 2005-06-03 05:44 AM A B 20 kB
Environment: The is a bit shift typo in Network Server reading clob/blob data size

Resolution Date: 04/Jun/05 04:30 PM


 Description  « Hide
in DDMReader.java
...
... readLengthAndCodePoint() ... {
...

switch (numberOfExtendedLenBytes) {
case 8:
ddmScalarLen =
((buffer[pos++] & 0xff) << 64) +
((buffer[pos++] & 0xff) << 56) +
((buffer[pos++] & 0xff) << 48) +
((buffer[pos++] & 0xff) << 40) +
((buffer[pos++] & 0xff) << 32) +
((buffer[pos++] & 0xff) << 16) +
((buffer[pos++] & 0xff) << 8) +
((buffer[pos++] & 0xff) << 0);
adjustSize = 12;
break;
case 6:
ddmScalarLen =
((buffer[pos++] & 0xff) << 48) +
((buffer[pos++] & 0xff) << 40) +
((buffer[pos++] & 0xff) << 32) +
((buffer[pos++] & 0xff) << 16) +
((buffer[pos++] & 0xff) << 8) +
((buffer[pos++] & 0xff) << 0);
adjustSize = 10;
break;
case 4:
ddmScalarLen =
((buffer[pos++] & 0xff) << 32) +
((buffer[pos++] & 0xff) << 16) +
((buffer[pos++] & 0xff) << 8) +
((buffer[pos++] & 0xff) << 0);
adjustSize = 8;
break;
...
The shift bits should be in order:
0,8,16,24
0,8,16,24,32,40
0,8,16,24,32,40,48,56

This will only affect a lob if its length requires at least 24 bits--i.e. if the lob has a length of at least 2^24 bytes.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Kathey Marsden added a comment - 25/May/05 07:56 AM
A corresponding change also needs to be made for the client

A B added a comment - 03/Jun/05 03:21 AM
Attaching patch to test and resolve this issue. In order to test, I had to create a new suite (separate from "derbyall") since the test case requires more JVM heap size than usual. The actual fix for the problem is as given in the description for this defect--I made that fix in both the Network Server code and in the Derby Client.

A B added a comment - 03/Jun/05 05:44 AM
Modified patch so that lobLengthTests.java uses a table name that correctly indicates the size of the test table we're using.

Also, per Kathey M's request, I'm including a "check-in comment" here:

----
1) Change Network Server and Derby Client code to do correct bit-shifting when processing the length of LOBs that are larger than 2^24 bytes (DERBY-121). 2) Add a new suite, "largeData", for running tests that require extra machine resources, and add the test for DERBY-121 to that suite (because the test for DERBY-121 requires extra heap memory for the server's JVM).
----

Kathey Marsden added a comment - 04/Jun/05 04:13 AM
Committed ...

Sending java\client\org\apache\derby\client\net\Reply.java
Sending java\drda\org\apache\derby\impl\drda\DDMReader.java
Sending java\testing\README.htm
Sending java\testing\build.xml
Sending java\testing\org\apache\derbyTesting\functionTests\harness\NetServer.java
Adding java\testing\org\apache\derbyTesting\functionTests\master\lobLengthTests.out
Adding java\testing\org\apache\derbyTesting\functionTests\suites\largeData.properties
Adding java\testing\org\apache\derbyTesting\functionTests\suites\largeDataClient.properties
Adding java\testing\org\apache\derbyTesting\functionTests\suites\largeDataNet.properties
Adding java\testing\org\apache\derbyTesting\functionTests\suites\largeDataTests.runall
Adding java\testing\org\apache\derbyTesting\functionTests\tests\largedata
Adding java\testing\org\apache\derbyTesting\functionTests\tests\largedata\build.xml
Adding java\testing\org\apache\derbyTesting\functionTests\tests\largedata\copyfiles.ant
Adding java\testing\org\apache\derbyTesting\functionTests\tests\largedata\lobLengthTests.java
Adding java\testing\org\apache\derbyTesting\functionTests\tests\largedata\lobLengthTests_app.properties
Transmitting file data ..............
Committed revision 179859.

A B added a comment - 04/Jun/05 05:51 AM
Patch was committed with svn revision 179859. I updated my codeline and ran the new suite to double-check, and it looks good. So I'm resolving and closing this issue.

Andrew McIntyre added a comment - 04/Jun/05 04:29 PM
Reopening to fix resolved field in JIRA.

Andrew McIntyre added a comment - 04/Jun/05 04:30 PM
Patch was committed with svn revision 179859. Closing.