Skip to content

fix issue #150 (in deleting case)#226

Merged
buger merged 1 commit intobuger:masterfrom
daria-kay:leading-spaces
Mar 19, 2021
Merged

fix issue #150 (in deleting case)#226
buger merged 1 commit intobuger:masterfrom
daria-kay:leading-spaces

Conversation

@daria-kay
Copy link
Contributor

Description: fix issue #150 (in deleting case)

Benchmark before change:

BenchmarkJsonParserLarge
BenchmarkJsonParserLarge-8                        149128             40492 ns/op               0 B/op          0 allocs/op
BenchmarkJsonParserMedium
BenchmarkJsonParserMedium-8                       876039              6657 ns/op               0 B/op          0 allocs/op
BenchmarkJsonParserDeleteMedium
BenchmarkJsonParserDeleteMedium-8                 823548              7070 ns/op               0 B/op          0 allocs/op
BenchmarkJsonParserEachKeyManualMedium
BenchmarkJsonParserEachKeyManualMedium-8         1371667              4380 ns/op             112 B/op          2 allocs/op
BenchmarkJsonParserEachKeyStructMedium
BenchmarkJsonParserEachKeyStructMedium-8         1229190              4880 ns/op             560 B/op         12 allocs/op
BenchmarkJsonParserObjectEachStructMedium
BenchmarkJsonParserObjectEachStructMedium-8       862562              6859 ns/op             512 B/op         11 allocs/op
BenchmarkJsonParserSmall
BenchmarkJsonParserSmall-8                       8717104               673 ns/op               0 B/op          0 allocs/op
BenchmarkJsonParserEachKeyManualSmall
BenchmarkJsonParserEachKeyManualSmall-8         11227440               537 ns/op              80 B/op          2 allocs/op
BenchmarkJsonParserEachKeyStructSmall
BenchmarkJsonParserEachKeyStructSmall-8          8229375               724 ns/op             184 B/op          7 allocs/op
BenchmarkJsonParserObjectEachStructSmall
BenchmarkJsonParserObjectEachStructSmall-8       9805533               614 ns/op             168 B/op          6 allocs/op
BenchmarkJsonParserSetSmall
BenchmarkJsonParserSetSmall-8                    6156210               972 ns/op             768 B/op          4 allocs/op
BenchmarkJsonParserDelSmall
BenchmarkJsonParserDelSmall-8                    4657131              1276 ns/op               0 B/op          0 allocs/op

Benchmark after change:

BenchmarkJsonParserLarge
BenchmarkJsonParserLarge-8                        147148             40662 ns/op               0 B/op          0 allocs/op
BenchmarkJsonParserMedium
BenchmarkJsonParserMedium-8                       872667              6710 ns/op               0 B/op          0 allocs/op
BenchmarkJsonParserDeleteMedium
BenchmarkJsonParserDeleteMedium-8                 823443              7106 ns/op               0 B/op          0 allocs/op
BenchmarkJsonParserEachKeyManualMedium
BenchmarkJsonParserEachKeyManualMedium-8         1363668              4446 ns/op             112 B/op          2 allocs/op
BenchmarkJsonParserEachKeyStructMedium
BenchmarkJsonParserEachKeyStructMedium-8         1215337              4927 ns/op             560 B/op         12 allocs/op
BenchmarkJsonParserObjectEachStructMedium
BenchmarkJsonParserObjectEachStructMedium-8       843268              6930 ns/op             512 B/op         11 allocs/op
BenchmarkJsonParserSmall
BenchmarkJsonParserSmall-8                       8753600               682 ns/op               0 B/op          0 allocs/op
BenchmarkJsonParserEachKeyManualSmall
BenchmarkJsonParserEachKeyManualSmall-8         11106930               540 ns/op              80 B/op          2 allocs/op
BenchmarkJsonParserEachKeyStructSmall
BenchmarkJsonParserEachKeyStructSmall-8          8219354               731 ns/op             184 B/op          7 allocs/op
BenchmarkJsonParserObjectEachStructSmall
BenchmarkJsonParserObjectEachStructSmall-8       9774537               625 ns/op             168 B/op          6 allocs/op
BenchmarkJsonParserSetSmall
BenchmarkJsonParserSetSmall-8                    5996592               984 ns/op             768 B/op          4 allocs/op
BenchmarkJsonParserDelSmall
BenchmarkJsonParserDelSmall-8                    4472648              1365 ns/op               0 B/op          0 allocs/op

@buger
Copy link
Owner

buger commented Mar 19, 2021

Looks cool!

Thank you!

@buger buger merged commit bf062a1 into buger:master Mar 19, 2021
@daria-kay daria-kay changed the title fix deletion by key with leading space fix issue #150 (in deleting case) Mar 19, 2021
@buger
Copy link
Owner

buger commented Mar 21, 2021

@daria-kay apparently OSS-Fuzz integration found issue with your PR. Would you like to check it?

https://google.github.io/oss-fuzz/advanced-topics/reproducing/


  | +----------------------------------------Release Build Stacktrace----------------------------------------+
-- | --
  | Command: /mnt/scratch0/clusterfuzz/bot/builds/clusterfuzz-builds_jsonparser_842b7742ab4fad0d63df92dcf84cec58705eaa50/revisions/fuzzdelete -rss_limit_mb=2560 -timeout=60 -runs=100 /mnt/scratch0/clusterfuzz/bot/inputs/fuzzer-testcases/crash-da39a3ee5e6b4b0d3255bfef95601890afd80709
  | Bot: oss-fuzz-linux-zone1-host-d2bp-0
  | Time ran: 0.035671234130859375
  |  
  | INFO: Running with entropic power schedule (0xFF, 100).
  | INFO: Seed: 1871214021
  | INFO: 2190 Extra Counters
  | /mnt/scratch0/clusterfuzz/bot/builds/clusterfuzz-builds_jsonparser_842b7742ab4fad0d63df92dcf84cec58705eaa50/revisions/fuzzdelete: Running 1 inputs 100 time(s) each.
  | Running: /mnt/scratch0/clusterfuzz/bot/inputs/fuzzer-testcases/crash-da39a3ee5e6b4b0d3255bfef95601890afd80709
  | panic: runtime error: index out of range [-1]
  |  
  | goroutine 17 [running, locked to thread]:
  | github.com/buger/jsonparser.findKeyStart(0x602000000090, 0x0, 0x0, 0x60fcb4, 0x4, 0x0, 0x0, 0x0)
  | github.com/buger/jsonparser/parser.go:64 +0xa6b
  | github.com/buger/jsonparser.Delete(0x602000000090, 0x0, 0x0, 0x10c000052e88, 0x1, 0x1, 0x55c1eb, 0x10c00002a060, 0x0)
  | github.com/buger/jsonparser/parser.go:731 +0xac6
  | github.com/buger/jsonparser.FuzzDelete(...)
  | github.com/buger/jsonparser/fuzz.go:31
  | main.LLVMFuzzerTestOneInput(...)
  | command-line-arguments/main.293696178.go:21
  | AddressSanitizer:DEADLYSIGNAL
  | =================================================================
  | ==15856==ERROR: AddressSanitizer: ABRT on unknown address 0x053900003df0 (pc 0x0000005bca01 bp 0x10c000052a48 sp 0x10c000052a30 T0)
  | SCARINESS: 10 (signal)
  | #0 0x5bca01 in runtime.raise runtime/sys_linux_amd64.s:164
  |  
  | AddressSanitizer can not provide additional info.
  | SUMMARY: AddressSanitizer: ABRT (/mnt/scratch0/clusterfuzz/bot/builds/clusterfuzz-builds_jsonparser_842b7742ab4fad0d63df92dcf84cec58705eaa50/revisions/fuzzdelete+0x5bca01)
  | ==15856==ABORTING
  |  
  |  
  | +----------------------------------------Release Build Unsymbolized Stacktrace (diff)----------------------------------------+
  |  
  | ==15856==ERROR: AddressSanitizer: ABRT on unknown address 0x053900003df0 (pc 0x0000005bca01 bp 0x10c000052a48 sp 0x10c000052a30 T0)
  | SCARINESS: 10 (signal)
  | #0 0x5bca01  (/mnt/scratch0/clusterfuzz/bot/builds/clusterfuzz-builds_jsonparser_842b7742ab4fad0d63df92dcf84cec58705eaa50/revisions/fuzzdelete+0x5bca01)
  |  
  | AddressSanitizer can not provide additional info.

@daria-kay
Copy link
Contributor Author

yes, i will try to fix it

@buger
Copy link
Owner

buger commented Apr 1, 2021

@daria-kay have you had a chance to check it?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants