Open
Description
Example
import com.google.common.truth.Truth;
import org.junit.jupiter.api.Test;
public class TruthTest {
@Test
void test() {
Truth.assertThat(new EvilThrowable()).isSameInstanceAs(new RuntimeException());
}
static class EvilThrowable extends Throwable {
@Override
public synchronized Throwable getCause() {
return new EvilThrowable();
}
}
}
This example does not terminate, it just spins forever.
I beleive this is because StackTraceCleaner does not implement any kind of hard limit (which is the only way I can think of of how to fix this).
I know this is a very specific edge case, it came up while trying to test code that does a similar thing (traverse a Throwable's causes) with a malicious/very broken implementation of a Throwable.
Activity