{"record":{"id":"7e3a727e301b0107","repo":"tsenart/vegeta","slug":"max-body-d-overflows-int64","errorCode":null,"errorMessage":"-max-body=%d overflows int64","messagePattern":"-max-body=(.+?) overflows int64","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"flags.go","lineNumber":121,"sourceCode":"\t}\n\treturn fmt.Sprintf(\"%d/%s\", f.Freq, f.Per)\n}\n\ntype maxBodyFlag struct{ n *int64 }\n\nfunc (f *maxBodyFlag) Set(v string) (err error) {\n\tif v == \"-1\" {\n\t\t*(f.n) = -1\n\t\treturn nil\n\t}\n\n\tvar ds datasize.ByteSize\n\tif err = ds.UnmarshalText([]byte(v)); err != nil {\n\t\treturn err\n\t}\n\n\tif ds > math.MaxInt64 {\n\t\treturn fmt.Errorf(\"-max-body=%d overflows int64\", ds)\n\t}\n\n\t*(f.n) = int64(ds)\n\treturn nil\n}\n\nfunc (f *maxBodyFlag) String() string {\n\tif f.n == nil {\n\t\treturn \"\"\n\t} else if *(f.n) == -1 {\n\t\treturn \"-1\"\n\t}\n\treturn datasize.ByteSize(*(f.n)).String()\n}\n\ntype dnsTTLFlag struct{ ttl *time.Duration }\n\nfunc (f *dnsTTLFlag) Set(v string) (err error) {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/tsenart/vegeta/blob/cf5811269046c672a604b1eb352204d30f16ae4a/flags.go#L103-L139","documentation":"The -max-body flag parses its value with a datasize.ByteSize (text form like 10MB). If the parsed size exceeds math.MaxInt64, it cannot be stored in the flag's int64 target, so Set returns this overflow error before assigning.","triggerScenarios":"Calling MaxBody.Set (or -max-body) with a datasize whose byte value exceeds math.MaxInt64, e.g. 9223372036854775808B or exabyte-range values.","commonSituations":"Typo in the size suffix or unit causing an enormous multiplier (e.g. 10EB); generated configs with unsanitized sizes; misunderstanding that the value is bytes capped at int64.","solutions":["Lower the -max-body value so it fits in int64 (< 9223372036854775807 bytes, i.e. < 8EB).","Use a sane size like -max-body=10MB.","Validate the configured size before passing it to vegeta.","Check for duplicated or concatenated suffixes (e.g. 10MBMB) that inflate the parsed value."],"exampleFix":"// before\nvegeta attack -max-body=9223372036854775808B ...\n// after\nvegeta attack -max-body=10MB ...","handlingStrategy":"validation","validationCode":"const maxInt64 uint64 = math.MaxInt64\nfunc fitsInt64(s string) bool {\n\tvar ds datasize.ByteSize\n\tif err := ds.UnmarshalText([]byte(s)); err != nil {\n\t\treturn false\n\t}\n\treturn uint64(ds) <= maxInt64\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep -max-body within realistic sizes (KB/MB/GB).","Check for typo'd or duplicated size suffixes.","Remember the limit is math.MaxInt64 bytes (< 8EB).","Validate size strings in config before passing to vegeta."],"tags":["cli","flag-parsing","integer-overflow"],"backgroundTag":"integer-overflow","analyzedSha":"cf5811269046c672a604b1eb352204d30f16ae4a","analyzedAt":"2026-08-31T11:04:20.464Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}