fix oob ruleindex (#3738)

* fix oob ruleindex

* updated expected values for tests

---------

Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
dev
Dogan Can Bakir 2023-05-25 11:52:51 +03:00 committed by GitHub
parent db1072381e
commit afaf850c89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 769 deletions

View File

@ -1,512 +1,2 @@
103.57.226.0 103.57.226.0/24
103.57.226.1 103.58.114.0/24
103.57.226.2
103.57.226.3
103.57.226.4
103.57.226.5
103.57.226.6
103.57.226.7
103.57.226.8
103.57.226.9
103.57.226.10
103.57.226.11
103.57.226.12
103.57.226.13
103.57.226.14
103.57.226.15
103.57.226.16
103.57.226.17
103.57.226.18
103.57.226.19
103.57.226.20
103.57.226.21
103.57.226.22
103.57.226.23
103.57.226.24
103.57.226.25
103.57.226.26
103.57.226.27
103.57.226.28
103.57.226.29
103.57.226.30
103.57.226.31
103.57.226.32
103.57.226.33
103.57.226.34
103.57.226.35
103.57.226.36
103.57.226.37
103.57.226.38
103.57.226.39
103.57.226.40
103.57.226.41
103.57.226.42
103.57.226.43
103.57.226.44
103.57.226.45
103.57.226.46
103.57.226.47
103.57.226.48
103.57.226.49
103.57.226.50
103.57.226.51
103.57.226.52
103.57.226.53
103.57.226.54
103.57.226.55
103.57.226.56
103.57.226.57
103.57.226.58
103.57.226.59
103.57.226.60
103.57.226.61
103.57.226.62
103.57.226.63
103.57.226.64
103.57.226.65
103.57.226.66
103.57.226.67
103.57.226.68
103.57.226.69
103.57.226.70
103.57.226.71
103.57.226.72
103.57.226.73
103.57.226.74
103.57.226.75
103.57.226.76
103.57.226.77
103.57.226.78
103.57.226.79
103.57.226.80
103.57.226.81
103.57.226.82
103.57.226.83
103.57.226.84
103.57.226.85
103.57.226.86
103.57.226.87
103.57.226.88
103.57.226.89
103.57.226.90
103.57.226.91
103.57.226.92
103.57.226.93
103.57.226.94
103.57.226.95
103.57.226.96
103.57.226.97
103.57.226.98
103.57.226.99
103.57.226.100
103.57.226.101
103.57.226.102
103.57.226.103
103.57.226.104
103.57.226.105
103.57.226.106
103.57.226.107
103.57.226.108
103.57.226.109
103.57.226.110
103.57.226.111
103.57.226.112
103.57.226.113
103.57.226.114
103.57.226.115
103.57.226.116
103.57.226.117
103.57.226.118
103.57.226.119
103.57.226.120
103.57.226.121
103.57.226.122
103.57.226.123
103.57.226.124
103.57.226.125
103.57.226.126
103.57.226.127
103.57.226.128
103.57.226.129
103.57.226.130
103.57.226.131
103.57.226.132
103.57.226.133
103.57.226.134
103.57.226.135
103.57.226.136
103.57.226.137
103.57.226.138
103.57.226.139
103.57.226.140
103.57.226.141
103.57.226.142
103.57.226.143
103.57.226.144
103.57.226.145
103.57.226.146
103.57.226.147
103.57.226.148
103.57.226.149
103.57.226.150
103.57.226.151
103.57.226.152
103.57.226.153
103.57.226.154
103.57.226.155
103.57.226.156
103.57.226.157
103.57.226.158
103.57.226.159
103.57.226.160
103.57.226.161
103.57.226.162
103.57.226.163
103.57.226.164
103.57.226.165
103.57.226.166
103.57.226.167
103.57.226.168
103.57.226.169
103.57.226.170
103.57.226.171
103.57.226.172
103.57.226.173
103.57.226.174
103.57.226.175
103.57.226.176
103.57.226.177
103.57.226.178
103.57.226.179
103.57.226.180
103.57.226.181
103.57.226.182
103.57.226.183
103.57.226.184
103.57.226.185
103.57.226.186
103.57.226.187
103.57.226.188
103.57.226.189
103.57.226.190
103.57.226.191
103.57.226.192
103.57.226.193
103.57.226.194
103.57.226.195
103.57.226.196
103.57.226.197
103.57.226.198
103.57.226.199
103.57.226.200
103.57.226.201
103.57.226.202
103.57.226.203
103.57.226.204
103.57.226.205
103.57.226.206
103.57.226.207
103.57.226.208
103.57.226.209
103.57.226.210
103.57.226.211
103.57.226.212
103.57.226.213
103.57.226.214
103.57.226.215
103.57.226.216
103.57.226.217
103.57.226.218
103.57.226.219
103.57.226.220
103.57.226.221
103.57.226.222
103.57.226.223
103.57.226.224
103.57.226.225
103.57.226.226
103.57.226.227
103.57.226.228
103.57.226.229
103.57.226.230
103.57.226.231
103.57.226.232
103.57.226.233
103.57.226.234
103.57.226.235
103.57.226.236
103.57.226.237
103.57.226.238
103.57.226.239
103.57.226.240
103.57.226.241
103.57.226.242
103.57.226.243
103.57.226.244
103.57.226.245
103.57.226.246
103.57.226.247
103.57.226.248
103.57.226.249
103.57.226.250
103.57.226.251
103.57.226.252
103.57.226.253
103.57.226.254
103.57.226.255
103.58.114.0
103.58.114.1
103.58.114.2
103.58.114.3
103.58.114.4
103.58.114.5
103.58.114.6
103.58.114.7
103.58.114.8
103.58.114.9
103.58.114.10
103.58.114.11
103.58.114.12
103.58.114.13
103.58.114.14
103.58.114.15
103.58.114.16
103.58.114.17
103.58.114.18
103.58.114.19
103.58.114.20
103.58.114.21
103.58.114.22
103.58.114.23
103.58.114.24
103.58.114.25
103.58.114.26
103.58.114.27
103.58.114.28
103.58.114.29
103.58.114.30
103.58.114.31
103.58.114.32
103.58.114.33
103.58.114.34
103.58.114.35
103.58.114.36
103.58.114.37
103.58.114.38
103.58.114.39
103.58.114.40
103.58.114.41
103.58.114.42
103.58.114.43
103.58.114.44
103.58.114.45
103.58.114.46
103.58.114.47
103.58.114.48
103.58.114.49
103.58.114.50
103.58.114.51
103.58.114.52
103.58.114.53
103.58.114.54
103.58.114.55
103.58.114.56
103.58.114.57
103.58.114.58
103.58.114.59
103.58.114.60
103.58.114.61
103.58.114.62
103.58.114.63
103.58.114.64
103.58.114.65
103.58.114.66
103.58.114.67
103.58.114.68
103.58.114.69
103.58.114.70
103.58.114.71
103.58.114.72
103.58.114.73
103.58.114.74
103.58.114.75
103.58.114.76
103.58.114.77
103.58.114.78
103.58.114.79
103.58.114.80
103.58.114.81
103.58.114.82
103.58.114.83
103.58.114.84
103.58.114.85
103.58.114.86
103.58.114.87
103.58.114.88
103.58.114.89
103.58.114.90
103.58.114.91
103.58.114.92
103.58.114.93
103.58.114.94
103.58.114.95
103.58.114.96
103.58.114.97
103.58.114.98
103.58.114.99
103.58.114.100
103.58.114.101
103.58.114.102
103.58.114.103
103.58.114.104
103.58.114.105
103.58.114.106
103.58.114.107
103.58.114.108
103.58.114.109
103.58.114.110
103.58.114.111
103.58.114.112
103.58.114.113
103.58.114.114
103.58.114.115
103.58.114.116
103.58.114.117
103.58.114.118
103.58.114.119
103.58.114.120
103.58.114.121
103.58.114.122
103.58.114.123
103.58.114.124
103.58.114.125
103.58.114.126
103.58.114.127
103.58.114.128
103.58.114.129
103.58.114.130
103.58.114.131
103.58.114.132
103.58.114.133
103.58.114.134
103.58.114.135
103.58.114.136
103.58.114.137
103.58.114.138
103.58.114.139
103.58.114.140
103.58.114.141
103.58.114.142
103.58.114.143
103.58.114.144
103.58.114.145
103.58.114.146
103.58.114.147
103.58.114.148
103.58.114.149
103.58.114.150
103.58.114.151
103.58.114.152
103.58.114.153
103.58.114.154
103.58.114.155
103.58.114.156
103.58.114.157
103.58.114.158
103.58.114.159
103.58.114.160
103.58.114.161
103.58.114.162
103.58.114.163
103.58.114.164
103.58.114.165
103.58.114.166
103.58.114.167
103.58.114.168
103.58.114.169
103.58.114.170
103.58.114.171
103.58.114.172
103.58.114.173
103.58.114.174
103.58.114.175
103.58.114.176
103.58.114.177
103.58.114.178
103.58.114.179
103.58.114.180
103.58.114.181
103.58.114.182
103.58.114.183
103.58.114.184
103.58.114.185
103.58.114.186
103.58.114.187
103.58.114.188
103.58.114.189
103.58.114.190
103.58.114.191
103.58.114.192
103.58.114.193
103.58.114.194
103.58.114.195
103.58.114.196
103.58.114.197
103.58.114.198
103.58.114.199
103.58.114.200
103.58.114.201
103.58.114.202
103.58.114.203
103.58.114.204
103.58.114.205
103.58.114.206
103.58.114.207
103.58.114.208
103.58.114.209
103.58.114.210
103.58.114.211
103.58.114.212
103.58.114.213
103.58.114.214
103.58.114.215
103.58.114.216
103.58.114.217
103.58.114.218
103.58.114.219
103.58.114.220
103.58.114.221
103.58.114.222
103.58.114.223
103.58.114.224
103.58.114.225
103.58.114.226
103.58.114.227
103.58.114.228
103.58.114.229
103.58.114.230
103.58.114.231
103.58.114.232
103.58.114.233
103.58.114.234
103.58.114.235
103.58.114.236
103.58.114.237
103.58.114.238
103.58.114.239
103.58.114.240
103.58.114.241
103.58.114.242
103.58.114.243
103.58.114.244
103.58.114.245
103.58.114.246
103.58.114.247
103.58.114.248
103.58.114.249
103.58.114.250
103.58.114.251
103.58.114.252
103.58.114.253
103.58.114.254
103.58.114.255

View File

@ -1,256 +1 @@
216.101.17.0 216.101.17.0/24
216.101.17.1
216.101.17.2
216.101.17.3
216.101.17.4
216.101.17.5
216.101.17.6
216.101.17.7
216.101.17.8
216.101.17.9
216.101.17.10
216.101.17.11
216.101.17.12
216.101.17.13
216.101.17.14
216.101.17.15
216.101.17.16
216.101.17.17
216.101.17.18
216.101.17.19
216.101.17.20
216.101.17.21
216.101.17.22
216.101.17.23
216.101.17.24
216.101.17.25
216.101.17.26
216.101.17.27
216.101.17.28
216.101.17.29
216.101.17.30
216.101.17.31
216.101.17.32
216.101.17.33
216.101.17.34
216.101.17.35
216.101.17.36
216.101.17.37
216.101.17.38
216.101.17.39
216.101.17.40
216.101.17.41
216.101.17.42
216.101.17.43
216.101.17.44
216.101.17.45
216.101.17.46
216.101.17.47
216.101.17.48
216.101.17.49
216.101.17.50
216.101.17.51
216.101.17.52
216.101.17.53
216.101.17.54
216.101.17.55
216.101.17.56
216.101.17.57
216.101.17.58
216.101.17.59
216.101.17.60
216.101.17.61
216.101.17.62
216.101.17.63
216.101.17.64
216.101.17.65
216.101.17.66
216.101.17.67
216.101.17.68
216.101.17.69
216.101.17.70
216.101.17.71
216.101.17.72
216.101.17.73
216.101.17.74
216.101.17.75
216.101.17.76
216.101.17.77
216.101.17.78
216.101.17.79
216.101.17.80
216.101.17.81
216.101.17.82
216.101.17.83
216.101.17.84
216.101.17.85
216.101.17.86
216.101.17.87
216.101.17.88
216.101.17.89
216.101.17.90
216.101.17.91
216.101.17.92
216.101.17.93
216.101.17.94
216.101.17.95
216.101.17.96
216.101.17.97
216.101.17.98
216.101.17.99
216.101.17.100
216.101.17.101
216.101.17.102
216.101.17.103
216.101.17.104
216.101.17.105
216.101.17.106
216.101.17.107
216.101.17.108
216.101.17.109
216.101.17.110
216.101.17.111
216.101.17.112
216.101.17.113
216.101.17.114
216.101.17.115
216.101.17.116
216.101.17.117
216.101.17.118
216.101.17.119
216.101.17.120
216.101.17.121
216.101.17.122
216.101.17.123
216.101.17.124
216.101.17.125
216.101.17.126
216.101.17.127
216.101.17.128
216.101.17.129
216.101.17.130
216.101.17.131
216.101.17.132
216.101.17.133
216.101.17.134
216.101.17.135
216.101.17.136
216.101.17.137
216.101.17.138
216.101.17.139
216.101.17.140
216.101.17.141
216.101.17.142
216.101.17.143
216.101.17.144
216.101.17.145
216.101.17.146
216.101.17.147
216.101.17.148
216.101.17.149
216.101.17.150
216.101.17.151
216.101.17.152
216.101.17.153
216.101.17.154
216.101.17.155
216.101.17.156
216.101.17.157
216.101.17.158
216.101.17.159
216.101.17.160
216.101.17.161
216.101.17.162
216.101.17.163
216.101.17.164
216.101.17.165
216.101.17.166
216.101.17.167
216.101.17.168
216.101.17.169
216.101.17.170
216.101.17.171
216.101.17.172
216.101.17.173
216.101.17.174
216.101.17.175
216.101.17.176
216.101.17.177
216.101.17.178
216.101.17.179
216.101.17.180
216.101.17.181
216.101.17.182
216.101.17.183
216.101.17.184
216.101.17.185
216.101.17.186
216.101.17.187
216.101.17.188
216.101.17.189
216.101.17.190
216.101.17.191
216.101.17.192
216.101.17.193
216.101.17.194
216.101.17.195
216.101.17.196
216.101.17.197
216.101.17.198
216.101.17.199
216.101.17.200
216.101.17.201
216.101.17.202
216.101.17.203
216.101.17.204
216.101.17.205
216.101.17.206
216.101.17.207
216.101.17.208
216.101.17.209
216.101.17.210
216.101.17.211
216.101.17.212
216.101.17.213
216.101.17.214
216.101.17.215
216.101.17.216
216.101.17.217
216.101.17.218
216.101.17.219
216.101.17.220
216.101.17.221
216.101.17.222
216.101.17.223
216.101.17.224
216.101.17.225
216.101.17.226
216.101.17.227
216.101.17.228
216.101.17.229
216.101.17.230
216.101.17.231
216.101.17.232
216.101.17.233
216.101.17.234
216.101.17.235
216.101.17.236
216.101.17.237
216.101.17.238
216.101.17.239
216.101.17.240
216.101.17.241
216.101.17.242
216.101.17.243
216.101.17.244
216.101.17.245
216.101.17.246
216.101.17.247
216.101.17.248
216.101.17.249
216.101.17.250
216.101.17.251
216.101.17.252
216.101.17.253
216.101.17.254
216.101.17.255

View File

@ -2,6 +2,7 @@ package sarif
import ( import (
"fmt" "fmt"
"math"
"os" "os"
"path" "path"
"sync" "sync"
@ -125,7 +126,7 @@ func (exporter *Exporter) Export(event *output.ResultEvent) error {
} }
// If rule is added // If rule is added
ruleIndex := len(exporter.rules) - 1 ruleIndex := int(math.Max(0, float64(len(exporter.rules)-1)))
if exporter.rulemap[rule.Id] == nil { if exporter.rulemap[rule.Id] == nil {
exporter.rulemap[rule.Id] = &ruleIndex exporter.rulemap[rule.Id] = &ruleIndex
exporter.rules = append(exporter.rules, rule) exporter.rules = append(exporter.rules, rule)