Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341427

Summary: Can't send data whose size "mod 256" result is between 128 bytes and 255 bytes to WebSocket server.
Product: [RT] Jetty Reporter: zhuhao03 <zhuhao03>
Component: serverAssignee: Greg Wilkins <gregw>
Status: CLOSED INVALID QA Contact:
Severity: critical    
Priority: P3    
Version: unspecified   
Target Milestone: 7.2.x   
Hardware: PC   
OS: Linux   
Whiteboard:

Description zhuhao03 CLA 2011-03-30 16:59:58 EDT
Build Identifier: 20100917-0705

WebSocketParserD06 and WebSocketParserD01 are both having bugs in parsing LENGTH_16 & LENGTH_63. There is a line "_length = _length<<8 | b", in which b should be an unsigned byte representing size. However, here b is treated as signed byte, and the _length can be NEGATIVE as a result.

The correct code should be "_length = _length<<8 | (b & 0xff)".

Reproducible: Always

Steps to Reproduce:
1. Run any simple websocket echo program. Remember to log the received message size in server side.
2. Send message with 128 bytes.
3. See the log message in server side. The message size is negative.
Comment 1 zhuhao03 CLA 2011-03-30 17:50:52 EDT
Ok. It seems my code has some problem. Close the bug.