mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 18:29:39 +02:00
Fuzz PGPObjectFactory
This commit is contained in:
parent
7daa3783bc
commit
46f5030608
10 changed files with 8 additions and 3 deletions
|
@ -5,7 +5,6 @@
|
||||||
package org.pgpainless.bouncycastle.fuzzing
|
package org.pgpainless.bouncycastle.fuzzing
|
||||||
|
|
||||||
import com.code_intelligence.jazzer.api.FuzzedDataProvider
|
import com.code_intelligence.jazzer.api.FuzzedDataProvider
|
||||||
import com.code_intelligence.jazzer.junit.DictionaryFile
|
|
||||||
import com.code_intelligence.jazzer.junit.FuzzTest
|
import com.code_intelligence.jazzer.junit.FuzzTest
|
||||||
import org.bouncycastle.bcpg.ArmoredInputException
|
import org.bouncycastle.bcpg.ArmoredInputException
|
||||||
import org.bouncycastle.bcpg.UnsupportedPacketVersionException
|
import org.bouncycastle.bcpg.UnsupportedPacketVersionException
|
||||||
|
@ -18,8 +17,6 @@ import java.io.IOException
|
||||||
class PGPObjectFactoryFuzzingTest {
|
class PGPObjectFactoryFuzzingTest {
|
||||||
|
|
||||||
@FuzzTest
|
@FuzzTest
|
||||||
@DictionaryFile(resourcePath = "ascii_armor.dict")
|
|
||||||
@DictionaryFile(resourcePath = "openpgp.dict")
|
|
||||||
fun parseFuzzedObjects(provider: FuzzedDataProvider) {
|
fun parseFuzzedObjects(provider: FuzzedDataProvider) {
|
||||||
val encoding = provider.consumeRemainingAsBytes()
|
val encoding = provider.consumeRemainingAsBytes()
|
||||||
|
|
||||||
|
@ -43,6 +40,13 @@ class PGPObjectFactoryFuzzingTest {
|
||||||
return
|
return
|
||||||
} catch (e: UnsupportedPacketVersionException) {
|
} catch (e: UnsupportedPacketVersionException) {
|
||||||
return
|
return
|
||||||
|
} catch (e: ClassCastException) {
|
||||||
|
if (e.message?.contains("SecretSubkeyPacket") ?: true) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
throw e
|
||||||
|
} catch (e: OutOfMemoryError) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
<EFBFBD>;--
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue