mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
commit
bbc4f11bcc
1
promql/fuzz-data/ParseExpr/corpus/from_tests_1
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_1
Normal file
|
@ -0,0 +1 @@
|
|||
1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_10
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_10
Normal file
|
@ -0,0 +1 @@
|
|||
0755
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_11
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_11
Normal file
|
@ -0,0 +1 @@
|
|||
+5.5e-3
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_12
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_12
Normal file
|
@ -0,0 +1 @@
|
|||
-0755
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_13
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_13
Normal file
|
@ -0,0 +1 @@
|
|||
1 + 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_14
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_14
Normal file
|
@ -0,0 +1 @@
|
|||
1 - 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_15
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_15
Normal file
|
@ -0,0 +1 @@
|
|||
1 * 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_16
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_16
Normal file
|
@ -0,0 +1 @@
|
|||
1 % 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_17
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_17
Normal file
|
@ -0,0 +1 @@
|
|||
1 / 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_18
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_18
Normal file
|
@ -0,0 +1 @@
|
|||
1 == 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_19
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_19
Normal file
|
@ -0,0 +1 @@
|
|||
1 != 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_2
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_2
Normal file
|
@ -0,0 +1 @@
|
|||
+Inf
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_20
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_20
Normal file
|
@ -0,0 +1 @@
|
|||
1 > 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_21
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_21
Normal file
|
@ -0,0 +1 @@
|
|||
1 >= 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_22
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_22
Normal file
|
@ -0,0 +1 @@
|
|||
1 < 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_23
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_23
Normal file
|
@ -0,0 +1 @@
|
|||
1 <= 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_24
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_24
Normal file
|
@ -0,0 +1 @@
|
|||
+1 + -2 * 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_25
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_25
Normal file
|
@ -0,0 +1 @@
|
|||
1 + 2/(3*1)
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_26
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_26
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_27
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_27
Normal file
|
@ -0,0 +1 @@
|
|||
#comment
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_28
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_28
Normal file
|
@ -0,0 +1 @@
|
|||
foo * bar
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_29
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_29
Normal file
|
@ -0,0 +1 @@
|
|||
foo == 1
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_3
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_3
Normal file
|
@ -0,0 +1 @@
|
|||
-Inf
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_30
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_30
Normal file
|
@ -0,0 +1 @@
|
|||
2.5 / bar
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_31
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_31
Normal file
|
@ -0,0 +1 @@
|
|||
foo and bar
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_32
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_32
Normal file
|
@ -0,0 +1 @@
|
|||
foo or bar
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_33
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_33
Normal file
|
@ -0,0 +1 @@
|
|||
foo + bar or bla and blub
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_34
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_34
Normal file
|
@ -0,0 +1 @@
|
|||
bar + on(foo) bla / on(baz, buz) group_right(test) blub
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_4
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_4
Normal file
|
@ -0,0 +1 @@
|
|||
.5
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_5
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_5
Normal file
|
@ -0,0 +1 @@
|
|||
5.
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_6
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_6
Normal file
|
@ -0,0 +1 @@
|
|||
123.4567
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_7
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_7
Normal file
|
@ -0,0 +1 @@
|
|||
5e-3
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_8
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_8
Normal file
|
@ -0,0 +1 @@
|
|||
5e3
|
1
promql/fuzz-data/ParseExpr/corpus/from_tests_9
Normal file
1
promql/fuzz-data/ParseExpr/corpus/from_tests_9
Normal file
|
@ -0,0 +1 @@
|
|||
0xc
|
3
promql/fuzz-data/ParseMetric/corpus/exposition_formats_0
Normal file
3
promql/fuzz-data/ParseMetric/corpus/exposition_formats_0
Normal file
|
@ -0,0 +1,3 @@
|
|||
# HELP api_http_request_count The total number of HTTP requests.
|
||||
# TYPE api_http_request_count counter
|
||||
http_request_count{method="post",code="200"} 1027 1395066363000
|
1
promql/fuzz-data/ParseMetric/corpus/exposition_formats_1
Normal file
1
promql/fuzz-data/ParseMetric/corpus/exposition_formats_1
Normal file
|
@ -0,0 +1 @@
|
|||
msdos_file_access_time_ms{path="C:\\DIR\\FILE.TXT",error="Cannot find file:\n\"FILE.TXT\""} 1.234e3
|
1
promql/fuzz-data/ParseMetric/corpus/exposition_formats_2
Normal file
1
promql/fuzz-data/ParseMetric/corpus/exposition_formats_2
Normal file
|
@ -0,0 +1 @@
|
|||
metric_without_timestamp_and_labels 12.47
|
1
promql/fuzz-data/ParseMetric/corpus/exposition_formats_3
Normal file
1
promql/fuzz-data/ParseMetric/corpus/exposition_formats_3
Normal file
|
@ -0,0 +1 @@
|
|||
something_weird{problem="division by zero"} +Inf -3982045
|
1
promql/fuzz-data/ParseMetric/corpus/exposition_formats_4
Normal file
1
promql/fuzz-data/ParseMetric/corpus/exposition_formats_4
Normal file
|
@ -0,0 +1 @@
|
|||
http_request_duration_seconds_bucket{le="+Inf"} 144320
|
87
promql/fuzz.go
Normal file
87
promql/fuzz.go
Normal file
|
@ -0,0 +1,87 @@
|
|||
// Copyright 2015 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Only build when go-fuzz is in use
|
||||
// +build gofuzz
|
||||
|
||||
package promql
|
||||
|
||||
// PromQL parser fuzzing instrumentation for use with
|
||||
// https://github.com/dvyukov/go-fuzz.
|
||||
//
|
||||
// Fuzz each parser by building appropriately instrumented parser, ex.
|
||||
// FuzzParseMetric and execute it with it's
|
||||
//
|
||||
// go-fuzz-build -func FuzzParseMetric -o FuzzParseMetric.zip github.com/prometheus/prometheus/promql
|
||||
//
|
||||
// And then run the tests with the appropriate inputs
|
||||
//
|
||||
// go-fuzz -bin FuzzParseMetric.zip -workdir fuzz-data/ParseMetric
|
||||
//
|
||||
// Further input samples should go in the folders fuzz-data/ParseMetric/corpus.
|
||||
//
|
||||
// Repeat for ParseMetricSeletion, ParseExpr and ParseStmt.
|
||||
|
||||
// Tuning which value is returned from Fuzz*-functions has a strong influence
|
||||
// on how quick the fuzzer converges on "interesting" cases. At least try
|
||||
// switching between fuzzMeh (= included in corpus, but not a priority) and
|
||||
// fuzzDiscard (=don't use this input for re-building later inputs) when
|
||||
// experimenting.
|
||||
const (
|
||||
fuzzInteresting = 1
|
||||
fuzzMeh = 0
|
||||
fuzzDiscard = -1
|
||||
)
|
||||
|
||||
// Fuzz the metric parser.
|
||||
//
|
||||
// Note that his is not the parser for the text-based exposition-format; that
|
||||
// lives in github.com/prometheus/client_golang/text.
|
||||
func FuzzParseMetric(in []byte) int {
|
||||
_, err := ParseMetric(string(in))
|
||||
if err == nil {
|
||||
return fuzzInteresting
|
||||
}
|
||||
|
||||
return fuzzMeh
|
||||
}
|
||||
|
||||
// Fuzz the metric selector parser.
|
||||
func FuzzParseMetricSelector(in []byte) int {
|
||||
_, err := ParseMetricSelector(string(in))
|
||||
if err == nil {
|
||||
return fuzzInteresting
|
||||
}
|
||||
|
||||
return fuzzMeh
|
||||
}
|
||||
|
||||
// Fuzz the expression parser.
|
||||
func FuzzParseExpr(in []byte) int {
|
||||
_, err := ParseExpr(string(in))
|
||||
if err == nil {
|
||||
return fuzzInteresting
|
||||
}
|
||||
|
||||
return fuzzMeh
|
||||
}
|
||||
|
||||
// Fuzz the parser.
|
||||
func FuzzParseStmts(in []byte) int {
|
||||
_, err := ParseStmts(string(in))
|
||||
if err == nil {
|
||||
return fuzzInteresting
|
||||
}
|
||||
|
||||
return fuzzMeh
|
||||
}
|
Loading…
Reference in a new issue