sqc 0.4.84

Software Code Quality - CERT C compliance checker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
{
  "ground_truth": [],
  "labels": [
    {
      "rule": "EXP33-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 83,
      "verdict": "FP",
      "confidence": "high",
      "reason": "valid is output param to lua_tointegerx; written before any read"
    },
    {
      "rule": "INT33-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 132,
      "verdict": "FP",
      "confidence": "high",
      "reason": "d==0 and d==-1 excluded by (lua_Unsigned)d+1u<=1u guard above"
    },
    {
      "rule": "INT10-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 132,
      "verdict": "FP",
      "confidence": "high",
      "reason": "modulo safe: zero and -1 divisor both excluded by prior guard"
    },
    {
      "rule": "EXP30-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 135,
      "verdict": "FP",
      "confidence": "high",
      "reason": "luaL_checknumber reads independent stack slots; no ordering hazard"
    },
    {
      "rule": "INT33-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 192,
      "verdict": "FP",
      "confidence": "high",
      "reason": "floating-point division; INT33-C covers integer division only"
    },
    {
      "rule": "FLP03-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 206,
      "verdict": "FP",
      "confidence": "high",
      "reason": "PI is non-zero compile-time constant; advisory fp exception check"
    },
    {
      "rule": "INT33-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 206,
      "verdict": "FP",
      "confidence": "high",
      "reason": "floating-point division by non-zero constant PI; INT33-C is for integers"
    },
    {
      "rule": "FLP03-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 212,
      "verdict": "FP",
      "confidence": "high",
      "reason": "180.0 is a non-zero constant; FLP03-C advisory inapplicable"
    },
    {
      "rule": "INT33-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 212,
      "verdict": "FP",
      "confidence": "high",
      "reason": "floating-point division by 180.0 constant; not integer division"
    },
    {
      "rule": "EXP33-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 221,
      "verdict": "FP",
      "confidence": "high",
      "reason": "ep is output param to frexp; frexp writes *ep before return"
    },
    {
      "rule": "EXP07-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 307,
      "verdict": "FP",
      "confidence": "high",
      "reason": "preprocessor width probe (ULONG_MAX>>31)>>31; not runtime assumption"
    },
    {
      "rule": "EXP07-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 307,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same preprocessor constant probe; EXP07-C targets runtime expressions"
    },
    {
      "rule": "EXP07-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 319,
      "verdict": "FP",
      "confidence": "high",
      "reason": "preprocessor probe for LUA_MAXUNSIGNED width; not runtime"
    },
    {
      "rule": "EXP07-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 319,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same preprocessor probe second instance"
    },
    {
      "rule": "INT14-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 345,
      "verdict": "FP",
      "confidence": "high",
      "reason": "intentional PRNG bit rotation; mixed bitwise/arithmetic is by design"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 345,
      "verdict": "FP",
      "confidence": "high",
      "reason": "callers always pass n in {7,45}; shift within 64-bit bounds"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 345,
      "verdict": "FP",
      "confidence": "high",
      "reason": "n is shift amount not bitwise operand; x is unsigned Rand64"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 345,
      "verdict": "FP",
      "confidence": "high",
      "reason": "64-n is 57 or 19 for valid callers; in-range for 64-bit shift"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 345,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same: n is shift count not the shifted operand (unsigned Rand64)"
    },
    {
      "rule": "INT14-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 352,
      "verdict": "FP",
      "confidence": "high",
      "reason": "intentional xoshiro256** PRNG state manipulation; by design"
    },
    {
      "rule": "EXP07-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 356,
      "verdict": "FP",
      "confidence": "high",
      "reason": "17 is the xoshiro256** algorithm shift constant; not an assumed value"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 431,
      "verdict": "FP",
      "confidence": "high",
      "reason": "i.h is l_uint32 (unsigned); n is shift amount not bitwise operand"
    },
    {
      "rule": "INT14-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 431,
      "verdict": "FP",
      "confidence": "high",
      "reason": "intentional 32-bit PRNG rotation; mixed bitwise/arithmetic by design"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 431,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_assert(n>0 && n<32) at line 430 validates n; shift in bounds"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 431,
      "verdict": "FP",
      "confidence": "high",
      "reason": "32-n bounded by same assert; trim32 result is unsigned l_uint32"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 431,
      "verdict": "FP",
      "confidence": "high",
      "reason": "i.l is l_uint32 unsigned; n is shift count not the bitwise operand"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 431,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same assert bounds n; i.l<<n is unsigned shift in range"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 461,
      "verdict": "FP",
      "confidence": "high",
      "reason": "rotl 32-bit: i.h is l_uint32; n is shift count not bitwise operand"
    },
    {
      "rule": "INT14-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 461,
      "verdict": "FP",
      "confidence": "high",
      "reason": "intentional rotation; lua_assert(n>0 && n<32) at line 460"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 461,
      "verdict": "FP",
      "confidence": "high",
      "reason": "assert bounds n in (0,32); i.h<<n is unsigned shift in range"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 461,
      "verdict": "FP",
      "confidence": "high",
      "reason": "32-n bounded by assert; trim32(i.l) is unsigned"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 462,
      "verdict": "FP",
      "confidence": "high",
      "reason": "32-n bounded by lua_assert at line 460; trim32(i.h) is unsigned"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 462,
      "verdict": "FP",
      "confidence": "high",
      "reason": "i.l is l_uint32 unsigned; n is shift amount not bitwise operand"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 462,
      "verdict": "FP",
      "confidence": "high",
      "reason": "i.l<<n: unsigned l_uint32; assert bounds n; shift in range"
    },
    {
      "rule": "INT14-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 468,
      "verdict": "FP",
      "confidence": "high",
      "reason": "rotl1: n reassigned to 64-n; mixed bitwise/arithmetic by design"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 469,
      "verdict": "FP",
      "confidence": "high",
      "reason": "packI operands i.h/i.l are l_uint32 unsigned; n is shift count"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 470,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same packI call; l_uint32 operands unsigned; n is shift amount"
    },
    {
      "rule": "DCL00-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 507,
      "verdict": "FP",
      "confidence": "high",
      "reason": "const-qual advisory on local variable h; trivial style nit"
    },
    {
      "rule": "INT14-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 507,
      "verdict": "FP",
      "confidence": "high",
      "reason": "FIGS is compile-time #define constant; not mixed runtime usage"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 507,
      "verdict": "FP",
      "confidence": "high",
      "reason": "FIGS<=32 in this branch; 32-FIGS>=0; shift always in bounds"
    },
    {
      "rule": "DCL00-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 530,
      "verdict": "FP",
      "confidence": "high",
      "reason": "const-qual advisory on local variable h; used once as multiplicand"
    },
    {
      "rule": "INT14-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 530,
      "verdict": "FP",
      "confidence": "high",
      "reason": "intentional PRNG float conversion; bitwise/arithmetic by design"
    },
    {
      "rule": "INT14-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 530,
      "verdict": "FP",
      "confidence": "high",
      "reason": "trim32 is bitwise mask; mixed arithmetic intentional in PRNG"
    },
    {
      "rule": "EXP07-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 540,
      "verdict": "FP",
      "confidence": "high",
      "reason": "constant 31 is algorithmic shift for I2UInt 64->32+32 split"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 545,
      "verdict": "FP",
      "confidence": "high",
      "reason": "n is lua_Unsigned (unsigned); >>31 on unsigned is defined"
    },
    {
      "rule": "EXP07-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 545,
      "verdict": "FP",
      "confidence": "high",
      "reason": "31 is the algorithmic split point for high/low halves of lua_Unsigned"
    },
    {
      "rule": "DCL13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 570,
      "verdict": "FP",
      "confidence": "high",
      "reason": "state->s is written by nextrand; state IS modified indirectly"
    },
    {
      "rule": "INT14-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 574,
      "verdict": "FP",
      "confidence": "high",
      "reason": "Mersenne-number loop: intentional mixed bitwise/arithmetic"
    },
    {
      "rule": "INT34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 575,
      "verdict": "FP",
      "confidence": "high",
      "reason": "sh starts at 1 doubles; lim all-ones before sh could overflow"
    },
    {
      "rule": "INT13-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 575,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lim is lua_Unsigned (unsigned); sh is positive shift amount int"
    },
    {
      "rule": "EXP34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 586,
      "verdict": "FP",
      "confidence": "high",
      "reason": "state from upvalue set by lua_newuserdatauv; guaranteed non-NULL"
    },
    {
      "rule": "EXP33-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 595,
      "verdict": "FP",
      "confidence": "high",
      "reason": "low/up assigned in all switch branches; default longjmps before use"
    },
    {
      "rule": "EXP34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 636,
      "verdict": "FP",
      "confidence": "high",
      "reason": "state from upvalue lua_newuserdatauv; luaM raises on OOM; non-NULL"
    },
    {
      "rule": "ARR02-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 647,
      "verdict": "FP",
      "confidence": "high",
      "reason": "sentinel-terminated luaL_Reg array; standard Lua API convention"
    },
    {
      "rule": "EXP34-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 659,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_newuserdatauv uses luaM_* which raises on OOM; never NULL"
    },
    {
      "rule": "ARR02-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 706,
      "verdict": "FP",
      "confidence": "high",
      "reason": "sentinel-terminated mathlib[] array; standard Lua convention"
    },
    {
      "rule": "API00-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 752,
      "verdict": "FP",
      "confidence": "high",
      "reason": "luaopen_* called by Lua runtime with valid state; L check absurd"
    },
    {
      "rule": "DCL15-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 752,
      "verdict": "FP",
      "confidence": "high",
      "reason": "LUAMOD_API declares intentional external linkage for module opener"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 755,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_setfield takes const char*; string literal not modified"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 757,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_setfield takes const char*; string literal not modified"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 759,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_setfield takes const char*; string literal not modified"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/lmathlib.c",
      "line": 761,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_setfield takes const char*; string literal not modified"
    },
    {
      "rule": "DCL30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 113,
      "verdict": "FP",
      "confidence": "high",
      "reason": "returns dlopen handle value stored in local var; not address of local"
    },
    {
      "rule": "ENV01-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 154,
      "verdict": "FP",
      "confidence": "high",
      "reason": "buff[MAX_PATH+1] is for GetModuleFileNameA not getenv; misfire"
    },
    {
      "rule": "MEM05-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 154,
      "verdict": "FP",
      "confidence": "high",
      "reason": "MAX_PATH+1 is compile-time constant; not a VLA"
    },
    {
      "rule": "EXP33-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 158,
      "verdict": "FP",
      "confidence": "high",
      "reason": "buff is output buffer to GetModuleFileNameA; written before use"
    },
    {
      "rule": "EXP34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 161,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lb==NULL check IS the if-condition; else only runs if non-NULL"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 161,
      "verdict": "FP",
      "confidence": "high",
      "reason": "*lb='\\0' is char-to-char assignment; no sign extension"
    },
    {
      "rule": "DCL13-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 216,
      "verdict": "FP",
      "confidence": "high",
      "reason": "void* signature must match other implementations; const would break API"
    },
    {
      "rule": "DCL13-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 228,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same cross-platform API constraint for lsys_sym parameter"
    },
    {
      "rule": "CON34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 279,
      "verdict": "FP",
      "confidence": "high",
      "reason": "Lua uses single-threaded state; threading advisory inapplicable"
    },
    {
      "rule": "ENV34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 281,
      "verdict": "FP",
      "confidence": "high",
      "reason": "path used immediately after getenv; no intervening env-modifying call"
    },
    {
      "rule": "CON34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 281,
      "verdict": "FP",
      "confidence": "high",
      "reason": "single-threaded Lua state; getenv thread-safety advisory irrelevant"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 287,
      "verdict": "FP",
      "confidence": "high",
      "reason": "path < dftmark is pointer comparison; not char-to-int conversion"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 287,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same line second instance; pointer arithmetic misidentified"
    },
    {
      "rule": "ENV30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 291,
      "verdict": "FP",
      "confidence": "high",
      "reason": "ct_diff2sz computes pointer difference; does not modify env string"
    },
    {
      "rule": "ENV30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 297,
      "verdict": "FP",
      "confidence": "high",
      "reason": "ct_diff2sz takes ptrdiff_t result; does not modify env string"
    },
    {
      "rule": "DCL30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 328,
      "verdict": "FP",
      "confidence": "high",
      "reason": "returns VALUE of plib (void*); not &plib; not a dangling pointer"
    },
    {
      "rule": "API05-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 336,
      "verdict": "FP",
      "confidence": "high",
      "reason": "structural-C99 conformant array syntax not used in Lua; FP"
    },
    {
      "rule": "API05-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 336,
      "verdict": "FP",
      "confidence": "high",
      "reason": "second API05-C same line; same rationale"
    },
    {
      "rule": "DCL13-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 336,
      "verdict": "FP",
      "confidence": "high",
      "reason": "ptr matches lua_Alloc typedef; const would break function pointer type"
    },
    {
      "rule": "EXP33-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 387,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lsys_load is a function call not a static variable; misidentified"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 408,
      "verdict": "FP",
      "confidence": "high",
      "reason": "path is char* pointer argument to lookforfunc; no char-to-int"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 408,
      "verdict": "FP",
      "confidence": "high",
      "reason": "second instance same column; pointer not char sign extension"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 408,
      "verdict": "FP",
      "confidence": "high",
      "reason": "init is char* pointer; no conversion to larger integer type"
    },
    {
      "rule": "FIO05-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 429,
      "verdict": "FP",
      "confidence": "high",
      "reason": "fopen probe for existence only; content not read; advisory FP"
    },
    {
      "rule": "WIN03-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 429,
      "verdict": "FP",
      "confidence": "high",
      "reason": "POSIX/generic section; Windows-specific handle inheritance advisory"
    },
    {
      "rule": "ERR00-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 431,
      "verdict": "FP",
      "confidence": "high",
      "reason": "fclose on read-probe handle; error irrelevant to probe purpose"
    },
    {
      "rule": "DCL13-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 441,
      "verdict": "FP",
      "confidence": "high",
      "reason": "end is boundary sentinel; const char* would be fine but advisory only"
    },
    {
      "rule": "EXP40-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 443,
      "verdict": "FP",
      "confidence": "high",
      "reason": "*name = *path is char-to-char assignment; no const pointer stripping"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 443,
      "verdict": "FP",
      "confidence": "high",
      "reason": "*path dereference assigned to char; no larger-type conversion"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 443,
      "verdict": "FP",
      "confidence": "high",
      "reason": "second instance same line; same char-to-char analysis"
    },
    {
      "rule": "MEM33-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 447,
      "verdict": "FP",
      "confidence": "high",
      "reason": "*name = *LUA_PATH_SEP is char assignment; no flexible array struct"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 447,
      "verdict": "FP",
      "confidence": "high",
      "reason": "*name = *LUA_PATH_SEP is char-to-char; no sign extension"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 453,
      "verdict": "FP",
      "confidence": "high",
      "reason": "*sep = '\\0' is char assignment; no conversion to larger type"
    },
    {
      "rule": "DCL30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 454,
      "verdict": "FP",
      "confidence": "high",
      "reason": "*path=sep writes pointer value into caller variable; not dangling"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 454,
      "verdict": "FP",
      "confidence": "high",
      "reason": "char assignment *path=...; no conversion to larger integer type"
    },
    {
      "rule": "STR34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 454,
      "verdict": "FP",
      "confidence": "high",
      "reason": "second instance same position; same char-to-char analysis"
    },
    {
      "rule": "DCL30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 455,
      "verdict": "FP",
      "confidence": "high",
      "reason": "returns name pointing into luaL_Buffer valid in caller frame"
    },
    {
      "rule": "EXP30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 503,
      "verdict": "FP",
      "confidence": "high",
      "reason": "luaL_checkstring reads independent stack positions; no hazard"
    },
    {
      "rule": "EXP30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 534,
      "verdict": "FP",
      "confidence": "high",
      "reason": "single call luaL_loadfilex; result compared before checkload called"
    },
    {
      "rule": "EXP34-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 560,
      "verdict": "FP",
      "confidence": "high",
      "reason": "modname is luaL_gsub result; always returns non-NULL string"
    },
    {
      "rule": "ARR02-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 684,
      "verdict": "FP",
      "confidence": "high",
      "reason": "sentinel-terminated pk_funcs[]; standard Lua API convention"
    },
    {
      "rule": "ARR02-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 697,
      "verdict": "FP",
      "confidence": "high",
      "reason": "sentinel-terminated ll_funcs[]; standard Lua convention"
    },
    {
      "rule": "ARR02-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 704,
      "verdict": "FP",
      "confidence": "high",
      "reason": "searchers[] size computed by sizeof division correctly"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 720,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_setfield key is const char*; string literal not modified"
    },
    {
      "rule": "API00-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 724,
      "verdict": "FP",
      "confidence": "high",
      "reason": "luaopen_package called by Lua runtime with valid state; L check absurd"
    },
    {
      "rule": "DCL15-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 724,
      "verdict": "FP",
      "confidence": "high",
      "reason": "LUAMOD_API is intentional external linkage for package opener"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 730,
      "verdict": "FP",
      "confidence": "high",
      "reason": "setpath fieldname param is const char*; string literal not modified"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 731,
      "verdict": "FP",
      "confidence": "high",
      "reason": "setpath envname param is const char*; not modified"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 735,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_setfield key is const char*; string literal not modified"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 738,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_setfield key is const char*; string literal not modified"
    },
    {
      "rule": "STR30-C",
      "file": "/home/brandon/toolchain/lua/loadlib.c",
      "line": 741,
      "verdict": "FP",
      "confidence": "high",
      "reason": "lua_setfield key is const char*; string literal not modified"
    },
    {
      "rule": "PRE05-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 425,
      "verdict": "FP",
      "confidence": "high",
      "reason": "l_floatatt uses ## intentionally; n is always literal token like MANT_DIG"
    },
    {
      "rule": "PRE05-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 442,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same macro long-double branch; ## paste intentional and correct"
    },
    {
      "rule": "PRE05-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 458,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same macro double branch; ## paste correct; no expansion needed"
    },
    {
      "rule": "PRE01-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 466,
      "verdict": "FP",
      "confidence": "high",
      "reason": "op is always a function name token; parenthesizing advisory only"
    },
    {
      "rule": "PRE00-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 602,
      "verdict": "FP",
      "confidence": "high",
      "reason": "p appears exactly once in replacement; no multiple evaluation"
    },
    {
      "rule": "PRE01-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 602,
      "verdict": "FP",
      "confidence": "high",
      "reason": "p in argument position of l_sprintf; parenthesizing advisory"
    },
    {
      "rule": "PRE12-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 602,
      "verdict": "FP",
      "confidence": "high",
      "reason": "p evaluated once in replacement text; PRE12-C misfire"
    },
    {
      "rule": "PRE01-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 626,
      "verdict": "FP",
      "confidence": "high",
      "reason": "op in (lua_Number)op; always single function name token; advisory"
    },
    {
      "rule": "PRE10-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 745,
      "verdict": "FP",
      "confidence": "high",
      "reason": "LUAI_MAXALIGN is struct field declarations not statements; do-while invalid"
    },
    {
      "rule": "PRE10-C",
      "file": "/home/brandon/toolchain/lua/luaconf.h",
      "line": 748,
      "verdict": "FP",
      "confidence": "high",
      "reason": "same macro C89 branch; declaration list not a statement sequence"
    }
  ],
  "fns": [],
  "files_reviewed": [
    "/home/brandon/toolchain/lua/lmathlib.c",
    "/home/brandon/toolchain/lua/loadlib.c",
    "/home/brandon/toolchain/lua/luaconf.h"
  ],
  "files_clean": [
    "/home/brandon/toolchain/lua/lmathlib.c",
    "/home/brandon/toolchain/lua/loadlib.c",
    "/home/brandon/toolchain/lua/luaconf.h"
  ],
  "summary": {
    "ground_truth": 0,
    "tp": 0,
    "fp": 123,
    "fn": 0
  }
}