Skip to content

Commit 3ec498b

Browse files
committed
Bumped version to 1.2.20; includes fixes for RTMP/E
1 parent edb5459 commit 3ec498b

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.red5</groupId>
55
<artifactId>red5-parent</artifactId>
6-
<version>1.2.19</version>
6+
<version>1.2.20</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>red5-server</artifactId>

src/main/java/org/red5/server/net/rtmpe/RTMPEIoFilter.java

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -119,29 +119,35 @@ public void messageReceived(NextFilter nextFilter, IoSession session, Object obj
119119
log.warn("Client was rejected due to invalid handshake");
120120
conn.close();
121121
}
122+
} else {
123+
// don't fall through to connected process if we didn't have enough for the handshake
124+
break;
122125
}
123126
// allow fall-through
124127
case RTMP.STATE_CONNECTED:
125-
IoBuffer message = buffer.getBufferAsIoBuffer();
126-
// assuming majority of connections will not be encrypted
127-
if (!((RTMPConnection) conn).isEncrypted()) {
128-
log.trace("Receiving message: {}", message);
129-
nextFilter.messageReceived(session, message);
130-
} else {
131-
Cipher cipher = (Cipher) session.getAttribute(RTMPConnection.RTMPE_CIPHER_IN);
132-
if (cipher != null) {
133-
if (log.isDebugEnabled()) {
134-
log.debug("Decrypting message: {}", message);
135-
}
136-
byte[] encrypted = new byte[message.remaining()];
137-
message.get(encrypted);
138-
message.free();
139-
byte[] plain = cipher.update(encrypted);
140-
IoBuffer messageDecrypted = IoBuffer.wrap(plain);
141-
if (log.isDebugEnabled()) {
142-
log.debug("Receiving decrypted message: {}", messageDecrypted);
128+
// skip empty buffer
129+
if (buffer.getBufferSize() > 0) {
130+
IoBuffer message = buffer.getBufferAsIoBuffer();
131+
// assuming majority of connections will not be encrypted
132+
if (!((RTMPConnection) conn).isEncrypted()) {
133+
log.trace("Receiving message: {}", message);
134+
nextFilter.messageReceived(session, message);
135+
} else {
136+
Cipher cipher = (Cipher) session.getAttribute(RTMPConnection.RTMPE_CIPHER_IN);
137+
if (cipher != null) {
138+
if (log.isDebugEnabled()) {
139+
log.debug("Decrypting message: {}", message);
140+
}
141+
byte[] encrypted = new byte[message.remaining()];
142+
message.get(encrypted);
143+
message.free();
144+
byte[] plain = cipher.update(encrypted);
145+
IoBuffer messageDecrypted = IoBuffer.wrap(plain);
146+
if (log.isDebugEnabled()) {
147+
log.debug("Receiving decrypted message: {}", messageDecrypted);
148+
}
149+
nextFilter.messageReceived(session, messageDecrypted);
143150
}
144-
nextFilter.messageReceived(session, messageDecrypted);
145151
}
146152
}
147153
break;

0 commit comments

Comments
 (0)