This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 778bd1d Fix potential infinite loop in SSL tests
778bd1d is described below
commit 778bd1dd6296271c9407c508a4a6a101af0ab4f1
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Dec 7 08:58:00 2020 +0000
Fix potential infinite loop in SSL tests
---
test/org/apache/tomcat/util/net/TestSsl.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/test/org/apache/tomcat/util/net/TestSsl.java
b/test/org/apache/tomcat/util/net/TestSsl.java
index 6e7f6c8..1f70b8f 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -126,7 +126,13 @@ public class TestSsl extends TomcatBaseTest {
byte[] endOfHeaders = "\r\n\r\n".getBytes();
int found = 0;
while (found != endOfHeaders.length) {
- if (is.read() == endOfHeaders[found]) {
+ int c = is.read();
+ if (c == -1) {
+ // EOF
+ System.err.println("Unexpected EOF");
+ errorCount.incrementAndGet();
+ break;
+ } else if (c == endOfHeaders[found]) {
found++;
} else {
found = 0;
@@ -253,7 +259,11 @@ public class TestSsl extends TomcatBaseTest {
char[] endOfHeaders ="\r\n\r\n".toCharArray();
int found = 0;
while (found != endOfHeaders.length) {
- if (r.read() == endOfHeaders[found]) {
+ int c = r.read();
+ if (c == -1) {
+ // EOF
+ Assert.fail("Unexpected EOF");
+ } else if (c == endOfHeaders[found]) {
found++;
} else {
found = 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]