[jcifs] [Fwd: Your Report (Review ID: 254855) - Low-byte of Long Truncated Incorrectly by Bitwise AND]

Michael B Allen mba2000 at ioplex.com
Mon Apr 19 01:02:43 GMT 2004


---------------------------- Original Message ----------------------------
Subject: Your Report (Review ID: 254855) - Low-byte of Long Truncated
Incorrectly by Bitwise AND From:    "IncidentDaemon at sun.com"
<IncidentDaemon at sun.com>
Date:    Sun, April 18, 2004 8:58 pm
To:      mba2000 at ioplex.com
--------------------------------------------------------------------------

************************************************
Your report has been assigned an internal review ID of: 254855

This review ID is NOT visible on the "Java Developer Connection" (JDC).

We greatly appreciate your interest in improving the quality
of Java(tm) Technology from Sun Microsystems.

Please be aware that the large volume of reports we receive
sometimes prevents us from responding individually to each
message.

We currently have a three week response time for responding to
Bug Reports.  If the information is determined to be a new bug,
or a duplicate of a known bug, you will receive a followup email
containing a seven digit bug number.  You may search for this bug
number on the "Java Developer Connection" (JDC) at this URL:
http://developer.java.sun.com/developer/bugParade/index.html.

If you just reported an issue that could have a major
impact on your project and you require a response,
please consider purchasing one of the support offerings
at this URL:
    http://java.sun.com/support/index.html


---------------------------------------------------------------


dateCreated: Sun Apr 18 18:58:43 MDT 2004
type:        bug
cust_name:   Michael B Allen
cust_email:  mba2000 at ioplex.com
jdcid:       mike_allen3
status:      Waiting
category:    hotspot
subcategory: runtime_system
company:     JCIFS
release:     1.4.2
hardware:    x86
OSversion:   Linux
priority:    4
synopsis:    Low-byte of Long Truncated Incorrectly by Bitwise AND
description: FULL PRODUCT VERSION :
J2SE 1.4.2_04, 1.4.2_01, or 1.5Beta1

FULL OS VERSION :
RedHat 9 2.4.20
RedHat 7.3 2.4.18

A DESCRIPTION OF THE PROBLEM :
After running with -server flag for about a minute the following code
emits a value that has a low-byte of 0x00 regardless of the input:

     offset & 0xFFFFFFFFL

The specific context is found in the jCIFS SMB/CIFS client library
available at http://jcifs.samba.org/ version 0.8.2 or below
jcifs/smb/SmbComWriteAndX.java line ~87.

    writeInt4( offset & 0xFFFFFFFFL, dst, dstIndex );

where offset is a long and writeInt4 is:

    static void writeInt4( long val, byte[] dst, int dstIndex ) {
        dst[dstIndex++] = (byte)((int)(val >>> 0) & 0xFF);
        dst[dstIndex++] = (byte)((int)(val >>> 8) & 0xFF);
        dst[dstIndex++] = (byte)((int)(val >>> 16) & 0xFF);
        dst[dstIndex++] = (byte)((int)(val >>> 24) & 0xFF);
    }

Running without -server or removing the unnecessary mask solves the problem.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Download:

http://jcifs.samba.org/src/jcifs-0.8.21x.jar
http://home.comcast.net/~miallen1/jcifs/testjcifs.jar

And run like:

java -server -cp testjcifs.jar:jcifs-0.8.2x1.jar testjcifs.FullTest
smb://server/share/ dom\;user:pass 500

where server is a SMB/CIFS server. After approxamately 45 seconds the
output will transition as follows:

Thread-0 creating Z1082335691040.tmp
Thread-0 creating Z1082335691150.tmp
Thread-42 reading X1082335675290.tmp
Thread-0 creating Z1082335691440.tmp
clobbered: 0x5800
clobbered: 0x5800
clobbered: 0x5800
clobbered: 0x5800

This means that the offset field encoded into the SMB_COM_WRITE_ANDX
request with an FID of 0x5800 had the low byte "clobbered" to 0x00.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The expression longValue & 0xFFFFFFFFL should not emit a value with a low
byte of 0x00 if the input longValue does not have a 0x00 low byte. ACTUAL
-
The expression longValue & 0xFFFFFFFFL emits a value with the low 8 byte
set to 0 regardless of whether or not the longValue has a non-0x00 low
byte.

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Do not use the HotSpot -server option or do not mask a long value with
0xFFFFFFFFL in this way. workaround:
comments:    (company - JCIFS , email - mba2000 at ioplex.com)





More information about the jcifs mailing list