Bug 1618739 - Don't assert fuzzer behavior in SSL_ParseSessionTicket r=jcj
authorKevin Jacobs <kjacobs@mozilla.com>
Mon, 09 Mar 2020 22:18:59 +0000
changeset 15531 12fc91fad84ad7f514d7abe64c15b375515a3710
parent 15530 08944e50dce0c95dfe009ceccf6608815bc56e5c
child 15532 710d10a72934b52713e44cba4a8aeb0668f2b9c0
push id3690
push userkjacobs@mozilla.com
push dateMon, 09 Mar 2020 22:32:04 +0000
reviewersjcj
bugs1618739
Bug 1618739 - Don't assert fuzzer behavior in SSL_ParseSessionTicket r=jcj Differential Revision: https://phabricator.services.mozilla.com/D66122
lib/ssl/ssl3exthandle.c
--- a/lib/ssl/ssl3exthandle.c
+++ b/lib/ssl/ssl3exthandle.c
@@ -1051,18 +1051,21 @@ ssl_ParseSessionTicket(sslSocket *ss, co
     }
 
     /* Read extendedMasterSecretUsed */
     rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 1, &buffer, &len);
     if (rv != SECSuccess) {
         PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
         return SECFailure;
     }
+#ifndef UNSAFE_FUZZER_MODE
+    /* A well-behaving server should only write 0 or 1. */
     PORT_Assert(temp == PR_TRUE || temp == PR_FALSE);
-    parsedTicket->extendedMasterSecretUsed = (PRBool)temp;
+#endif
+    parsedTicket->extendedMasterSecretUsed = temp ? PR_TRUE : PR_FALSE;
 
     rv = ssl3_ExtConsumeHandshake(ss, &temp, 4, &buffer, &len);
     if (rv != SECSuccess) {
         PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
         return SECFailure;
     }
     parsedTicket->flags = PR_ntohl(temp);