Skip to content

StompDecoder fails for partial headers containing escape sequence [SPR-13416] #17995

Closed
@spring-projects-issues

Description

@spring-projects-issues

Michael Kötter opened SPR-13416 and commented

We encountered frequent disconnects in our STOMP-Websocket application and traced the issue to the following exceptions occuring in StompDecoder:

org.springframework.messaging.simp.stomp.StompConversionException: Illegal escape sequence at index 2: ID\
..
org.springframework.messaging.simp.stomp.StompConversionException: Illegal escape sequence at index 41: ID\cf9677c70d5f4-59973-1440685240095-7\c1\

StompDecoder seems to decode the message in chunks, which is fine as long as the chunk doesn't end right after the start of an escape sequence in the header (as is the case with the above exceptions).

This is related to #17025, which doesn't really fix the root cause - the message header is not necessarily invalid because it ends with "", it's just incomplete, and the next chunk would probably contain the remaining bits.

Attached is a patch with proposed fix (only parses headers after an EOL was encountered) and test case to reproduce the issue.


Affects: 4.1.7, 4.2 GA

Attachments:

Issue Links:

Referenced from: commits 4428c34, daa49c9

Backported to: 4.1.8

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions