y-crdt / y-octo

CRDT implementation which is compatible with https://github.com/yjs/yjs
https://octobase.pro/
Other
187 stars 5 forks source link

feat: prevent memory alloc dos attack #13

Closed darkskygit closed 1 year ago

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 66.66% and project coverage change: -0.03% :warning:

Comparison is base (bb61d97) 79.06% compared to head (829bfa1) 79.04%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #13 +/- ## ========================================== - Coverage 79.06% 79.04% -0.03% ========================================== Files 39 39 Lines 6249 6252 +3 ========================================== + Hits 4941 4942 +1 - Misses 1308 1310 +2 ``` | [Flag](https://app.codecov.io/gh/toeverything/y-octo/pull/13/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=toeverything) | Coverage Δ | | |---|---|---| | [node-binding-test](https://app.codecov.io/gh/toeverything/y-octo/pull/13/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=toeverything) | `22.17% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=toeverything#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files Changed](https://app.codecov.io/gh/toeverything/y-octo/pull/13?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=toeverything) | Coverage Δ | | |---|---|---| | [y-octo/src/doc/codec/update.rs](https://app.codecov.io/gh/toeverything/y-octo/pull/13?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=toeverything#diff-eS1vY3RvL3NyYy9kb2MvY29kZWMvdXBkYXRlLnJz) | `86.68% <66.66%> (-0.36%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 1 year ago

Benchmark for Linux

Click to view benchmark | Test | Base | PR | % | | --- | --- | --- | --- | | codec/jwst decode var_int (32 bit) | 419.2±19.62µs | 434.0±21.51µs | +3.53% | | codec/jwst decode var_uint (32 bit) | 382.0±33.11µs | 395.5±27.07µs | +3.53% | | codec/jwst decode var_uint (64 bit) | 378.4±16.34µs | 398.4±29.74µs | **+5.29%** | | codec/jwst encode var_int (32 bit) | 561.1±31.96µs | 581.4±29.66µs | +3.62% | | codec/jwst encode var_uint (32 bit) | 337.2±17.56µs | 343.9±19.58µs | +1.99% | | codec/jwst encode var_uint (64 bit) | 324.3±16.05µs | 347.4±13.56µs | **+7.12%** | | codec/lib0 decode var_int (64 bit) | 336.3±19.26µs | 355.3±16.84µs | **+5.65%** | | codec/lib0 decode var_uint (32 bit) | 288.5±14.60µs | 308.9±12.92µs | **+7.07%** | | codec/lib0 decode var_uint (64 bit) | 289.2±18.04µs | 317.3±24.52µs | **+9.72%** | | codec/lib0 encode var_int (64 bit) | 508.6±31.62µs | 514.1±21.53µs | +1.08% | | codec/lib0 encode var_uint (32 bit) | 320.9±13.43µs | 347.9±15.17µs | **+8.41%** | | codec/lib0 encode var_uint (64 bit) | 335.3±16.76µs | 346.9±13.48µs | +3.46% | | ops/array/jwst/insert | 428.0±18.88µs | 427.9±20.52µs | -0.02% | | ops/array/jwst/insert range | 595.4±21.07µs | 597.9±22.98µs | +0.42% | | ops/array/jwst/remove | 293.3±14.15µs | 302.7±13.19µs | +3.20% | | ops/array/yrs/insert | 96.4±4.54µs | 97.1±4.03µs | +0.73% | | ops/array/yrs/insert range | 129.1±6.15µs | 128.0±7.41µs | -0.85% | | ops/array/yrs/remove | 117.8±8.56µs | 121.3±5.42µs | +2.97% | | ops/text/jwst/insert | 187.8±7.80µs | 186.9±7.86µs | -0.48% | | ops/text/jwst/remove | 3.7±0.25µs | 3.7±0.12µs | -0.00% | | ops/text/yrs/insert | 50.3±2.23µs | 49.5±2.30µs | -1.59% | | ops/text/yrs/remove | 3.1±0.15µs | 2.8±0.16µs | **-9.68%** | | update/parse with jwst/basic.bin | 92.0±4.70µs | 89.4±4.36µs | -2.83% | | update/parse with jwst/database.bin | 73.4±5.46µs | 71.1±2.97µs | **-3.13%** | | update/parse with jwst/large.bin | 6.4±0.26ms | 6.0±0.19ms | **-6.25%** | | update/parse with jwst/with-subdoc.bin | 8.5±0.34µs | 8.2±0.56µs | **-3.53%** | | update/parse with yrs/basic.bin | 54.9±2.82µs | 59.5±3.02µs | **+8.38%** | | update/parse with yrs/database.bin | 43.9±1.58µs | 47.0±1.76µs | **+7.06%** | | update/parse with yrs/large.bin | 3.8±0.18ms | 4.1±0.17ms | **+7.89%** | | update/parse with yrs/with-subdoc.bin | 6.9±0.27µs | 7.5±0.32µs | **+8.70%** |

Benchmark for Windows

Click to view benchmark | Test | Base | PR | % | | --- | --- | --- | --- | | codec/jwst decode var_int (32 bit) | 626.6±28.85µs | 638.2±23.12µs | +1.85% | | codec/jwst decode var_uint (32 bit) | 430.4±22.64µs | 427.0±25.50µs | -0.79% | | codec/jwst decode var_uint (64 bit) | 365.6±21.12µs | 371.2±16.90µs | +1.53% | | codec/jwst encode var_int (32 bit) | 582.8±23.17µs | 560.0±29.12µs | -3.91% | | codec/jwst encode var_uint (32 bit) | 432.3±23.43µs | 422.7±28.78µs | -2.22% | | codec/jwst encode var_uint (64 bit) | 437.9±25.23µs | 455.4±14.81µs | **+4.00%** | | codec/lib0 decode var_int (64 bit) | 476.2±26.58µs | 488.4±22.95µs | +2.56% | | codec/lib0 decode var_uint (32 bit) | 296.5±31.43µs | 268.3±20.45µs | **-9.51%** | | codec/lib0 decode var_uint (64 bit) | 331.1±39.39µs | 288.8±13.45µs | **-12.78%** | | codec/lib0 encode var_int (64 bit) | 652.2±40.31µs | 677.9±34.88µs | +3.94% | | codec/lib0 encode var_uint (32 bit) | 480.7±58.05µs | 462.2±26.95µs | -3.85% | | codec/lib0 encode var_uint (64 bit) | 532.9±77.27µs | 452.2±25.34µs | **-15.14%** | | ops/array/jwst/insert | 498.8±21.99µs | 483.1±26.27µs | -3.15% | | ops/array/jwst/insert range | 665.2±18.17µs | 628.2±27.13µs | **-5.56%** | | ops/array/jwst/remove | 322.0±15.23µs | 317.2±15.72µs | -1.49% | | ops/array/yrs/insert | 121.1±4.08µs | 118.0±6.10µs | -2.56% | | ops/array/yrs/insert range | 170.2±6.14µs | 172.9±6.10µs | +1.59% | | ops/array/yrs/remove | 185.7±6.24µs | 184.9±5.98µs | -0.43% | | ops/text/jwst/insert | 220.1±9.59µs | 212.6±7.17µs | **-3.41%** | | ops/text/jwst/remove | 4.2±0.21µs | 5.1±0.13µs | **+21.43%** | | ops/text/yrs/insert | 55.4±2.96µs | 56.0±1.79µs | +1.08% | | ops/text/yrs/remove | 4.2±0.22µs | 5.2±0.16µs | **+23.81%** | | update/parse with jwst/basic.bin | 111.6±6.81µs | 112.6±3.51µs | +0.90% | | update/parse with jwst/database.bin | 87.3±3.50µs | 90.8±2.32µs | **+4.01%** | | update/parse with jwst/large.bin | 5.4±0.17ms | 5.3±0.20ms | **-1.85%** | | update/parse with jwst/with-subdoc.bin | 17.6±0.76µs | 17.1±0.65µs | **-2.84%** | | update/parse with yrs/basic.bin | 75.9±3.77µs | 76.6±2.80µs | +0.92% | | update/parse with yrs/database.bin | 62.5±3.24µs | 61.3±1.65µs | **-1.92%** | | update/parse with yrs/large.bin | 3.6±0.18ms | 3.6±0.16ms | -0.00% | | update/parse with yrs/with-subdoc.bin | 14.2±0.52µs | 14.4±0.88µs | **+1.41%** |
github-actions[bot] commented 1 year ago

Benchmark for Linux

Click to view benchmark | Test | Base | PR | % | | --- | --- | --- | --- | | codec/jwst decode var_int (32 bit) | 417.4±19.15µs | 421.5±34.15µs | +0.98% | | codec/jwst decode var_uint (32 bit) | 356.3±17.77µs | 369.3±17.52µs | +3.65% | | codec/jwst decode var_uint (64 bit) | 362.9±18.08µs | 377.9±18.43µs | +4.13% | | codec/jwst encode var_int (32 bit) | 538.8±29.13µs | 541.6±24.22µs | +0.52% | | codec/jwst encode var_uint (32 bit) | 327.8±13.50µs | 325.4±17.32µs | -0.73% | | codec/jwst encode var_uint (64 bit) | 325.5±20.05µs | 328.0±14.50µs | +0.77% | | codec/lib0 decode var_int (64 bit) | 330.8±19.87µs | 342.2±14.88µs | +3.45% | | codec/lib0 decode var_uint (32 bit) | 292.0±16.79µs | 297.5±16.62µs | +1.88% | | codec/lib0 decode var_uint (64 bit) | 294.5±15.90µs | 294.3±12.30µs | -0.07% | | codec/lib0 encode var_int (64 bit) | 489.4±23.55µs | 484.8±24.82µs | -0.94% | | codec/lib0 encode var_uint (32 bit) | 331.9±16.26µs | 338.6±16.53µs | +2.02% | | codec/lib0 encode var_uint (64 bit) | 320.2±21.12µs | 334.4±15.45µs | +4.43% | | ops/array/jwst/insert | 432.8±21.38µs | 442.2±21.22µs | +2.17% | | ops/array/jwst/insert range | 592.5±24.98µs | 591.8±25.18µs | -0.12% | | ops/array/jwst/remove | 287.4±11.42µs | 295.3±11.87µs | +2.75% | | ops/array/yrs/insert | 103.9±13.49µs | 100.4±5.62µs | -3.37% | | ops/array/yrs/insert range | 124.0±6.36µs | 126.6±6.80µs | +2.10% | | ops/array/yrs/remove | 113.3±4.64µs | 114.5±6.07µs | +1.06% | | ops/text/jwst/insert | 178.1±6.07µs | 175.3±7.43µs | -1.57% | | ops/text/jwst/remove | 3.7±0.14µs | 3.8±0.14µs | **+2.70%** | | ops/text/yrs/insert | 48.2±1.81µs | 49.1±2.07µs | +1.87% | | ops/text/yrs/remove | 2.6±0.12µs | 2.7±0.15µs | **+3.85%** | | update/parse with jwst/basic.bin | 84.7±2.89µs | 87.8±4.92µs | **+3.66%** | | update/parse with jwst/database.bin | 66.9±3.46µs | 69.3±2.69µs | **+3.59%** | | update/parse with jwst/large.bin | 6.1±0.22ms | 5.9±0.26ms | **-3.28%** | | update/parse with jwst/with-subdoc.bin | 7.8±0.47µs | 8.0±0.29µs | **+2.56%** | | update/parse with yrs/basic.bin | 53.6±2.06µs | 54.3±2.30µs | +1.31% | | update/parse with yrs/database.bin | 45.3±5.69µs | 43.5±1.65µs | **-3.97%** | | update/parse with yrs/large.bin | 3.7±0.14ms | 3.7±0.15ms | -0.00% | | update/parse with yrs/with-subdoc.bin | 6.4±0.37µs | 7.7±0.35µs | **+20.31%** |

Benchmark for Windows

Click to view benchmark | Test | Base | PR | % | | --- | --- | --- | --- | | codec/jwst decode var_int (32 bit) | 533.9±7.63µs | 530.5±7.65µs | -0.64% | | codec/jwst decode var_uint (32 bit) | 394.4±14.50µs | 389.1±6.66µs | -1.34% | | codec/jwst decode var_uint (64 bit) | 325.3±4.55µs | 323.1±3.84µs | -0.68% | | codec/jwst encode var_int (32 bit) | 491.3±7.01µs | 490.5±6.99µs | -0.16% | | codec/jwst encode var_uint (32 bit) | 419.1±103.93µs | 386.2±4.83µs | **-7.85%** | | codec/jwst encode var_uint (64 bit) | 385.5±5.43µs | 386.7±5.71µs | +0.31% | | codec/lib0 decode var_int (64 bit) | 434.7±6.02µs | 431.4±4.97µs | -0.76% | | codec/lib0 decode var_uint (32 bit) | 244.3±3.67µs | 242.9±2.96µs | -0.57% | | codec/lib0 decode var_uint (64 bit) | 244.4±4.57µs | 243.5±2.95µs | -0.37% | | codec/lib0 encode var_int (64 bit) | 615.3±22.16µs | 604.1±9.38µs | **-1.82%** | | codec/lib0 encode var_uint (32 bit) | 400.9±5.89µs | 396.4±5.74µs | -1.12% | | codec/lib0 encode var_uint (64 bit) | 405.6±7.39µs | 408.5±6.72µs | +0.71% | | ops/array/jwst/insert | 427.0±8.24µs | 419.9±4.55µs | **-1.66%** | | ops/array/jwst/insert range | 552.2±8.21µs | 551.3±4.62µs | -0.16% | | ops/array/jwst/remove | 272.7±3.13µs | 273.1±3.41µs | +0.15% | | ops/array/yrs/insert | 106.3±1.27µs | 110.7±1.13µs | **+4.14%** | | ops/array/yrs/insert range | 150.3±2.54µs | 149.8±1.25µs | -0.33% | | ops/array/yrs/remove | 160.0±1.77µs | 157.2±2.69µs | **-1.75%** | | ops/text/jwst/insert | 188.8±4.92µs | 184.8±1.83µs | **-2.12%** | | ops/text/jwst/remove | 3.7±0.04µs | 4.5±0.04µs | **+21.62%** | | ops/text/yrs/insert | 47.1±0.58µs | 47.6±0.50µs | **+1.06%** | | ops/text/yrs/remove | 3.7±0.04µs | 4.5±0.04µs | **+21.62%** | | update/parse with jwst/basic.bin | 99.3±2.05µs | 97.6±0.91µs | **-1.71%** | | update/parse with jwst/database.bin | 76.9±1.13µs | 76.8±0.81µs | **-0.13%** | | update/parse with jwst/large.bin | 4.9±0.22ms | 4.6±0.12ms | **-6.12%** | | update/parse with jwst/with-subdoc.bin | 14.9±0.22µs | 14.9±0.23µs | -0.00% | | update/parse with yrs/basic.bin | 66.7±0.99µs | 66.7±0.61µs | -0.00% | | update/parse with yrs/database.bin | 51.7±0.55µs | 52.4±0.60µs | **+1.35%** | | update/parse with yrs/large.bin | 3.3±0.12ms | 3.2±0.61ms | **-3.03%** | | update/parse with yrs/with-subdoc.bin | 12.5±0.15µs | 11.6±0.11µs | **-7.20%** |