Closed
Bug 42047
Opened 24 years ago
Closed 24 years ago
A bug in implement of nsWriteToSocket() at nsSocketTransport.cpp#972
Categories
(Core :: Networking, defect, P3)
Tracking
()
People
(Reporter: bitspirit, Assigned: gagan)
Details
(Whiteboard: [nsbeta2-])
Original bug line: http:/
/lxr.mozilla.org/seamonkey/source/netwerk/base/src/nsSocketTransport.cpp#972 ,
in implement of nsWriteToSocket()
len = PR_Write(fd, fromRawSegment, count);
I think it should be:
len = PR_Write(fd, fromRawSegment + toOffset, count);
It could just be a lapsus calami:-)
Comment 1•24 years ago
|
||
Should be looked at, thus confirming. toOffset is an unused parameter.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Reporter | ||
Comment 2•24 years ago
|
||
When I hack nsStockTransport by a NSPR-IO-layer of mine, I find if PR_Write
return a value less than "count", nsSocketTransport will make second call on
PR_Write for sending remaining data in internal buffer "mWriteBuffer", at this
time, toOffset>0, but the bug line will just send the data that it have sent.
So, should change sending buffer pointer to fromRawSegment+toOffset
Comment 4•24 years ago
|
||
hmmm... it looks like you're right.
I think that the rawSegment offset should be used in both nsReadFromSocket(...)
and nsWriteToSocket(...).
Is that right warren? That the offset argument represents an offset into the
raw segment??
-- rick
Comment 5•24 years ago
|
||
The offset represents the offset from the beginning of the stream (as I recall).
Comment 6•24 years ago
|
||
hey warren,
are you sure? I'm talking about the offset argument in the function being
passed to ReadSegments and WriteSegments...
-- rick
Comment 7•24 years ago
|
||
Ok, looking at nsWriteToRawBuffer / nsReadFromRawBuffer in nsPipe2.cpp, I see
that the offset is relative to the destination / source buffers, respectively.
Comment 8•24 years ago
|
||
so it sounds like the offset should be added into the rawSegment in both
nsReadFromSocket(...) and nsWriteToSocket(...).
Gagan, will you do this?
-- rick
Comment 9•24 years ago
|
||
I don't think so. RawSegment is the internal buffer and has nothing to do with
the logical offset.
Comment 10•24 years ago
|
||
I thought that the offset represented the offset into the rawSegment...
no?
-- rick
Comment 12•24 years ago
|
||
Comparing to nsPipe2.cpp's nsWriteToRawBuffer, I don't think the proposed fix is
correct. The offset if relative to the destination for 'write', not to the
internal buffer. If anything, we should assert if toOffset isn't 0 since you
can't seek on a socket.
Comment 13•24 years ago
|
||
However, in nsSocketTransport there's another case when it writes directly from
the stream, and it that case I think the offset is the offset from the buffer?
Status: NEW → ASSIGNED
Comment 14•24 years ago
|
||
Putting on [nsbeta2-] radar. Not critical to beta2.
Whiteboard: [nsbeta2-]
Assignee | ||
Comment 15•24 years ago
|
||
pulling in ruslan's necko bugs ->darin
Assignee: ruslan → gagan
Status: ASSIGNED → NEW
Target Milestone: --- → M19
Reporter | ||
Comment 16•24 years ago
|
||
The bug just hit out when return value of PR_Write() is less than length of
data that caller wanna send. Although necko used a no block socket, this status
is unfamiliar, so the bug seem deathly. But when we run mozilla on a slowly
network, the bug could jump out:-(
We can recur this bug use a hacked PR_Write() returning a smaller value
advisedly.
Comment 17•24 years ago
|
||
*** This bug has been marked as a duplicate of 54081 ***
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•