{"record":{"id":"488d69f48c06267f","repo":"shadow1ng/fscan","slug":"parser-start-gt-end-488d69","errorCode":null,"errorMessage":"parser_start_gt_end","messagePattern":"parser_start_gt_end","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/parsers/parsers.go","lineNumber":407,"sourceCode":"\t\tallIP = append(allIP, fmt.Sprintf(\"%s.%d\", prefixIP, i))\n\t}\n\n\treturn allIP, nil\n}\n\n// parseIPFullRange 解析完整格式的IP范围\nfunc parseIPFullRange(startIP, endIP net.IP) ([]string, error) {\n\tstart4 := startIP.To4()\n\tend4 := endIP.To4()\n\tif start4 == nil || end4 == nil {\n\t\treturn nil, fmt.Errorf(\"%s\", i18n.GetText(\"parser_ipv4_only\"))\n\t}\n\n\tstartInt := (int(start4[0]) << 24) | (int(start4[1]) << 16) | (int(start4[2]) << 8) | int(start4[3])\n\tendInt := (int(end4[0]) << 24) | (int(end4[1]) << 16) | (int(end4[2]) << 8) | int(end4[3])\n\n\tif startInt > endInt {\n\t\treturn nil, fmt.Errorf(\"%s\", i18n.GetText(\"parser_start_gt_end\"))\n\t}\n\n\tvar ips []string\n\tcurrent := make(net.IP, len(start4))\n\tcopy(current, start4)\n\n\tfor {\n\t\tips = append(ips, current.String())\n\t\tif current.Equal(end4) {\n\t\t\tbreak\n\t\t}\n\t\tincrementIP(current)\n\t}\n\n\treturn ips, nil\n}\n\n// incrementIP 计算下一个IP地址","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/common/parsers/parsers.go#L389-L425","documentation":"parseIPFullRange converts both IPv4 endpoints to 32-bit integers and requires the start to be less than or equal to the end. When startInt > endInt the range would be empty/backwards, so this error is returned.","triggerScenarios":"A full-format range like '192.168.1.254-192.168.1.10' where the start address numerically exceeds the end address.","commonSituations":"Swapped endpoints from copy-paste; ranges written descending intentionally (not supported); dynamically built ranges where the interval became empty after filtering.","solutions":["Swap the endpoints so the start IP is <= the end IP, e.g. '192.168.1.10-192.168.1.254'.","Pre-compare the parsed net.IP values in the caller and normalize the order before calling.","Skip/emit a warning for empty ranges instead of passing backwards ones."],"exampleFix":"// before\nParseIPRangeString(\"192.168.1.254-192.168.1.10\")\n// after\nParseIPRangeString(\"192.168.1.10-192.168.1.254\")","handlingStrategy":"validation","validationCode":"func orderedFullRange(startStr, endStr string) bool {\n    s, e := net.ParseIP(startStr).To4(), net.ParseIP(endStr).To4()\n    if s == nil || e == nil { return false }\n    return bytes.Compare(s, e) <= 0\n}","typeGuard":null,"tryCatchPattern":"ips, err := parseIPRangeString(rangeStr)\nif err != nil {\n    return fmt.Errorf(\"range endpoints out of order in %q: %w\", rangeStr, err)\n}","preventionTips":["Compare parsed IPs with bytes.Compare before constructing the range","Swap endpoints automatically when start > end","Warn instead of erroring on empty ranges in bulk target loading"],"tags":["ip-range","validation","range"],"backgroundTag":"invalid-argument-value","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}