Skip to content

RleEncoderV2: baseBytes overflows for when bit size of option.min needs 64bit determined by findClosestNumBits for numbers to be encoded by PATCHED_BASE #2323

@AngleNet

Description

@AngleNet

HI ALL:
we are using orc as our main file format. we met Corrupt PATCHED_BASE encoded data (pl==0)! recently. after a few investigation we identified baseBytes could overflow when bit size of option.min > 56, findClosestNumBits could return 64. baseBytes could be 9 after baseWidth % 8 == 0 ? baseWidth / 8 : (baseWidth / 8) + 1. however baseBytes only has 3 bits in the header which leads to 0 after put it in the header byte.

input numbers to reproduce (512 lines)

 -20190782914723840
 -20190782914723839
 -20190782914723838
 -20190782914723837
 -20190782914723836
 -20190782914723835
 -20190782914723834
 -20190782914723833
 -20190782914723832
 -20190782914723831
 -20190782914723830
 -20190782914723829
 -20190782914723828
 -20190782914723827
 -20190782914723826
 -20190782914723825
 -20190782914723824
 -20190782914723823
 -20190782914723822
 -20190782914723821
 -20190782914723820
 -20190782914723819
 -20190782914723818
 -20190782914723817
 -20190782914723816
 -20190782914723815
 -20190782914723814
 -20190782914723813
 -20190782914723812
 -20190782914723811
 -20190782914723810
 -20190782914723809
 -20190782914723808
 -20190782914723807
 -20190782914723806
 -20190782914723805
 -20190782914723804
 -20190782914723803
 -20190782914723802
 -20190782914723801
 -20190782914723800
 -20190782914723799
 -20190782914723798
 -20190782914723797
 -20190782914723796
 -20190782914723795
 -20190782914723794
 -20190782914723793
 -20190782914723792
 -20190782914723791
 -20190782914723790
 -20190782914723789
 -20190782914723788
 -20190782914723787
 -20190782914723786
 -20190782914723785
 -20190782914723784
 -20190782914723783
 -20190782914723782
 -20190782914723781
 -20190782914723780
 -20190782914723779
 -20190782914723778
 -20190782914723777
 -20190782914723776
 -20190782914723775
 -20190782914723774
 -20190782914723773
 -20190782914723772
 -20190782914723771
 -20190782914723770
 -20190782914723769
 -20190782914723768
 -20190782914723767
 -20190782914723766
 -20190782914723765
 -20190782914723764
 -20190782914723763
 -20190782914723762
 -20190782914723761
 -20190782914723760
 -20190782914723759
 -20190782914723758
 -20190782914723757
 -20190782914723756
 -20190782914723755
 -20190782914723754
 -20190782914723753
 -20190782914723752
 -20190782914723751
 -20190782914723750
 -20190782914723749
 -20190782914723748
 -20190782914723747
 -20190782914723746
 -20190782914723745
 -20190782914723744
 -20190782914723743
 -20190782914723742
 -20190782914723741
 -20190782914723740
 -20190782914723739
 -20190782914723738
 -20190782914723737
 -20190782914723736
 -20190782914723735
 -20190782914723734
 -20190782914723733
 -20190782914723732
 -20190782914723731
 -20190782914723730
 -20190782914723729
 -20190782914723728
 -20190782914723727
 -20190782914723726
 -20190782914723725
 -20190782914723724
 -20190782914723723
 -20190782914723722
 -20190782914723721
 -20190782914723720
 -20190782914723719
 -20190782914723718
 -20190782914723717
 -20190782914723716
 -20190782914723715
 -20190782914723714
 -20190782914723713
 -20190782914723712
 -20190782914723711
 -20190782914723710
 -20190782914723709
 -20190782914723708
 -20190782914723707
 -20190782914723706
 -20190782914723705
 -20190782914723704
 -20190782914723703
 -20190782914723702
 -20190782914723701
 -20190782914723700
 -20190782914723699
 -20190782914723698
 -20190782914723697
 -20190782914723696
 -20190782914723695
 -20190782914723694
 -20190782914723693
 -20190782914723692
 -20190782914723691
 -20190782914723690
 -20190782914723689
 -20190782914723688
 -20190782914723687
 -20190782914723686
 -20190782914723685
 -20190782914723684
 -20190782914723683
 -20190782914723682
 -20190782914723681
 -20190782914723680
 -20190782914723679
 -20190782914723678
 -20190782914723677
 -20190782914723676
 -20190782914723675
 -20190782914723674
 -20190782914723673
 -20190782914723672
 -20190782914723671
 -20190782914723670
 -20190782914723669
 -20190782914723668
 -20190782914723667
 -20190782914723666
 -20190782914723665
 -20190782914723664
 -20190782914723663
 -20190782914723662
 -20190782914723661
 -20190782914723660
 -20190782914723659
 -20190782914723658
 -20190782914723657
 -20190782914723656
 -20190782914723655
 -20190782914723654
 -20190782914723653
 -20190782914723652
 -20190782914723651
 -20190782914723650
 -20190782914723649
 -20190782914723648
 -20190782914723647
 -20190782914723646
 -20190782914723645
 -20190782914723644
 -20190782914723643
 -20190782914723642
 -20190782914723641
 -20190782914723640
 -20190782914723639
 -20190782914723638
 -20190782914723637
 -20190782914723636
 -20190782914723635
 -20190782914723634
 -20190782914723633
 -20190782914723632
 -20190782914723631
 -20190782914723630
 -20190782914723629
 -20190782914723628
 -20190782914723627
 -20190782914723626
 -20190782914723625
 -20190782914723624
 -20190782914723623
 -20190782914723622
 -20190782914723621
 -20190782914723620
 -20190782914723619
 -20190782914723618
 -20190782914723617
 -20190782914723616
 -20190782914723615
 -20190782914723614
 -20190782914723613
 -20190782914723612
 -20190782914723611
 -20190782914723610
 -20190782914723609
 -20190782914723608
 -20190782914723607
 -20190782914723606
 -20190782914723605
 -20190782914723604
 -20190782914723603
 -20190782914723602
 -20190782914723601
 -20190782914723600
 -20190782914723599
 -20190782914723598
 -20190782914723597
 -20190782914723596
 -20190782914723595
 -20190782914723594
 -20190782914723593
 -20190782914723592
 -20190782914723591
 -20190782914723590
 -20190782914723589
 -20190782914723588
 -20190782914723587
 -20190782914723586
 -20190782914723585
 -20190782914723584
 -20190782914723583
 -20190782914723582
 -20190782914723581
 -20190782914723580
 -20190782914723579
 -20190782914723578
 -20190782914723577
 -20190782914723576
 -20190782914723575
 -20190782914723574
 -20190782914723573
 -20190782914723572
 -20190782914723571
 -20190782914723570
 -20190782914723569
 -20190782914723568
 -20190782914723567
 -20190782914723566
 -20190782914723565
 -20190782914723564
 -20190782914723563
 -20190782914723562
 -20190782914723561
 -20190782914723560
 -20190782914723559
 -20190782914723558
 -20190782914723557
 -20190782914723556
 -20190782914723555
 -20190782914723554
 -20190782914723553
 -20190782914723552
 -20190782914723551
 -20190782914723550
 -20190782914723549
 -20190782914723548
 -20190782914723547
 -20190782914723546
 -20190782914723545
 -20190782914723544
 -20190782914723543
 -20190782914723542
 -20190782914723541
 -20190782914723540
 -20190782914723539
 -20190782914723538
 -20190782914723537
 -20190782914723536
 -20190782914723535
 -20190782914723534
 -20190782914723533
 -20190782914723532
 -20190782914723531
 -20190782914723530
 -20190782914723529
 -20190782914723528
 -20190782914723527
 -20190782914723526
 -20190782914723525
 -20190782914723524
 -20190782914723523
 -20190782914723522
 -20190782914723521
 -20190782914723520
 -20190782914723519
 -20190782914723518
 -20190782914723517
 -20190782914723516
 -20190782914723515
 -20190782914723514
 -20190782914723513
 -20190782914723512
 -20190782914723511
 -20190782914723510
 -20190782914723509
 -20190782914723508
 -20190782914723507
 -20190782914723506
 -20190782914723505
 -20190782914723504
 -20190782914723503
 -20190782914723502
 -20190782914723501
 -20190782914723500
 -20190782914723499
 -20190782914723498
 -20190782914723497
 -20190782914723496
 -20190782914723495
 -20190782914723494
 -20190782914723493
 -20190782914723492
 -20190782914723491
 -20190782914723490
 -20190782914723489
 -20190782914723488
 -20190782914723487
 -20190782914723486
 -20190782914723485
 -20190782914723484
 -20190782914723483
 -20190782914723482
 -20190782914723481
 -20190782914723480
 -20190782914723479
 -20190782914723478
 -20190782914723477
 -20190782914723476
 -20190782914723475
 -20190782914723474
 -20190782914723473
 -20190782914723472
 -20190782914723471
 -20190782914723470
 -20190782914723469
 -20190782914723468
 -20190782914723467
 -20190782914723466
 -20190782914723465
 -20190782914723464
 -20190782914723463
 -20190782914723462
 -20190782914723461
 -20190782914723460
 -20190782914723459
 -20190782914723458
 -20190782914723457
 -20190782914723456
 -20190782914723455
 -20190782914723454
 -20190782914723453
 -20190782914723452
 -20190782914723451
 -20190782914723450
 -20190782914723449
 -20190782914723448
 -20190782914723447
 -20190782914723446
 -20190782914723445
 -20190782914723444
 -20190782914723443
 -20190782914723442
 -20190782914723441
 -20190782914723440
 -20190782914723439
 -20190782914723438
 -20190782914723437
 -20190782914723436
 -20190782914723435
 -20190782914723434
 -20190782914723433
 -20190782914723432
 -20190782914723431
 -20190782914723430
 -20190782914723429
 -20190782914723428
 -20190782914723427
 -20190782914723426
 -20190782914723425
 -20190782914723424
 -20190782914723423
 -20190782914723422
 -20190782914723421
 -20190782914723420
 -20190782914723419
 -20190782914723418
 -20190782914723417
 -20190782914723416
 -20190782914723415
 -20190782914723414
 -20190782914723413
 -20190782914723412
 -20190782914723411
 -20190782914723410
 -20190782914723409
 -20190782914723408
 -20190782914723407
 -20190782914723406
 -20190782914723405
 -20190782914723404
 -20190782914723403
 -20190782914723402
 -20190782914723401
 -20190782914723400
 -20190782914723399
 -20190782914723398
 -20190782914723397
 -20190782914723396
 -20190782914723395
 -20190782914723394
 -20190782914723393
 -20190782914723392
 -20190782914723391
 -20190782914723390
 -20190782914723389
 -20190782914723388
 -20190782914723387
 -20190782914723386
 -20190782914723385
 -20190782914723384
 -20190782914723383
 -20190782914723382
 -20190782914723381
 -20190782914723380
 -20190782914723379
 -20190782914723378
 -20190782914723377
 -20190782914723376
 -20190782914723375
 -20190782914723374
 -20190782914723373
 -20190782914723372
 -20190782914723371
 -20190782914723370
 -20190782914723369
 -20190782914723368
 -20190782914723367
 -20190782914723366
 -20190782914723365
 -20190782914723364
 -20190782914723363
 -20190782914723362
 -20190782914723361
 -20190782914723360
 -20190782914723359
 -20190782914723358
 -20190782914723357
 -20190782914723356
 -20190782914723355
 -20190782914723354
 -20190782914723353
 -13447865416974336
 -13447859288637440
 -89820196946542592
 -89820196946542591
 -89820196946542590
 -89820196946542589
 -89820196946542588
 -89820196946542587
 -89820196946542586
 -89820196946542585
 -89820196946542584
 -89820196946542583
 -89820196946542582
 -89820196946542581
 -89820196946542580
 -89820196946542579
 -89820196946542578
 -89820196946542577
 -89820196946542576
 -89820196946542575
 -89820196946542574
 -89820196946542573
 -89820196946542572
 -89820196946542571

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions