Skip to content

Commit

Permalink
Reproducing of Play-JSON DoS playframework/play-json#180
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk committed Sep 18, 2018
1 parent d832842 commit 9e30202
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ArrayOfZonedDateTimesBenchmark extends CommonParams {
}) | 1))),
zoneIds(i % zoneIds.length))
}.toArray
jsonString = obj.mkString("[\"", "\",\"", "\"]")
jsonString = "[1000000000e1000000000]"
jsonBytes = jsonString.getBytes(UTF_8)
preallocatedBuf = new Array[Byte](jsonBytes.length + preallocatedOff + 100/*to avoid possible out of bounds error*/)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ class ArrayOfZonedDateTimesBenchmarkSpec extends BenchmarkSpecBase {

"ArrayOfZonedDateTimesBenchmark" should {
"deserialize properly" in {
/*
benchmark.readAVSystemGenCodec() shouldBe benchmark.obj
benchmark.readCirce() shouldBe benchmark.obj
benchmark.readJacksonScala() shouldBe benchmark.obj
benchmark.readJsoniterScala() shouldBe benchmark.obj
*/
benchmark.readPlayJson() shouldBe benchmark.obj
/*
benchmark.readUPickle() shouldBe benchmark.obj
*/
}
"serialize properly" in {
/*
toString(benchmark.writeAVSystemGenCodec()) shouldBe benchmark.jsonString
toString(benchmark.writeCirce()) shouldBe benchmark.jsonString
toString(benchmark.writeJacksonScala()) shouldBe benchmark.jsonString
toString(benchmark.writeJsoniterScala()) shouldBe benchmark.jsonString
toString(benchmark.preallocatedBuf, benchmark.preallocatedOff, benchmark.writeJsoniterScalaPrealloc()) shouldBe benchmark.jsonString
toString(benchmark.writePlayJson()) shouldBe benchmark.jsonString
toString(benchmark.writeUPickle()) shouldBe benchmark.jsonString
*/
}
}
}

0 comments on commit 9e30202

Please sign in to comment.