Debug: stop base64 decode after > 10 bad bytes

This commit is contained in:
M66B
2023-01-01 22:24:07 +01:00
parent 4413bd0af9
commit 348b57bc4e

View File

@@ -335,6 +335,7 @@ public class BASE64DecoderStream extends FilterInputStream {
*/
private int getByte() throws IOException {
int c;
int bad = 0;
do {
if (input_pos >= input_len) {
try {
@@ -353,6 +354,8 @@ public class BASE64DecoderStream extends FilterInputStream {
return -2;
// no, convert it
c = pem_convert_array[c];
if (c == -1 && ++bad > 10 && eu.faircode.email.BuildConfig.DEBUG)
return -1;
// loop until we get a legitimate byte
} while (c == -1);
return c;