File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
main/java/org/springframework/messaging/simp/stomp
test/java/org/springframework/messaging/simp/stomp Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -260,6 +260,9 @@ private String unescape(String inString) {
260
260
261
261
while (index >= 0 ) {
262
262
sb .append (inString .substring (pos , index ));
263
+ if ((index + 1 ) >= inString .length ()) {
264
+ throw new StompConversionException ("Illegal escape sequence at index " + index + ": " + inString );
265
+ }
263
266
Character c = inString .charAt (index + 1 );
264
267
if (c == 'r' ) {
265
268
sb .append ('\r' );
Original file line number Diff line number Diff line change @@ -185,6 +185,13 @@ public void incompleteCommand() throws InterruptedException {
185
185
assertEquals (0 , messages .size ());
186
186
}
187
187
188
+ @ Test (expected = StompConversionException .class ) // SPR-12418
189
+ public void endingBackslashHeaderValueCheck () throws InterruptedException {
190
+ BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 128 );
191
+ String payload = "SEND\n a:alpha\\ \n \n Message body\0 " ;
192
+ stompDecoder .decode (toByteBuffer (payload ));
193
+ }
194
+
188
195
189
196
private ByteBuffer toByteBuffer (String chunk ) {
190
197
return ByteBuffer .wrap (chunk .getBytes (Charset .forName ("UTF-8" )));
You can’t perform that action at this time.
0 commit comments