{"record":{"id":"f078dd7693da4cf7","repo":"SixLabors/ImageSharp","slug":"invalid-progressive-parameters-ss-ss-se-se-ah-ah-al-al","errorCode":null,"errorMessage":"Invalid progressive parameters Ss={ss} Se={se} Ah={ah} Al={al}.","messagePattern":"Invalid progressive parameters Ss=(.+?) Se=(.+?) Ah=(.+?) Al=(.+?)\\.","errorType":"exception","errorClass":"InvalidImageContentException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs","lineNumber":24,"sourceCode":"internal static class JpegThrowHelper\n{\n    public static void ThrowNotSupportedException(string errorMessage) => throw new NotSupportedException(errorMessage);\n\n    public static void ThrowInvalidImageContentException(string errorMessage) => throw new InvalidImageContentException(errorMessage);\n\n    public static void ThrowBadMarker(string marker, int length) => throw new InvalidImageContentException($\"Marker {marker} has bad length {length}.\");\n\n    public static void ThrowNotEnoughBytesForMarker(byte marker) => throw new InvalidImageContentException($\"Input stream does not have enough bytes to parse declared contents of the {marker:X2} marker.\");\n\n    public static void ThrowBadQuantizationTableIndex(int index) => throw new InvalidImageContentException($\"Bad Quantization Table index {index}.\");\n\n    public static void ThrowBadQuantizationTablePrecision(int precision) => throw new InvalidImageContentException($\"Unknown Quantization Table precision {precision}.\");\n\n    public static void ThrowBadSampling() => throw new InvalidImageContentException(\"Bad sampling factor.\");\n\n    public static void ThrowBadSampling(int factor) => throw new InvalidImageContentException($\"Bad sampling factor: {factor}\");\n\n    public static void ThrowBadProgressiveScan(int ss, int se, int ah, int al) => throw new InvalidImageContentException($\"Invalid progressive parameters Ss={ss} Se={se} Ah={ah} Al={al}.\");\n\n    public static void ThrowInvalidImageDimensions(int width, int height) => throw new InvalidImageContentException($\"Invalid image dimensions: {width}x{height}.\");\n\n    public static void ThrowDimensionsTooLarge(int width, int height) => throw new ImageFormatException($\"Image is too large to encode at {width}x{height} for JPEG format.\");\n\n    public static void ThrowNotSupportedComponentCount(int componentCount) => throw new NotSupportedException($\"Images with {componentCount} components are not supported.\");\n\n    public static void ThrowNotSupportedColorSpace() => throw new NotSupportedException(\"Image color space could not be deduced.\");\n}\n","sourceCodeStart":6,"sourceCodeEnd":34,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs#L6-L34","documentation":"JpegThrowHelper.ThrowBadProgressiveScan(ss, se, ah, al) throws InvalidImageContentException when a progressive JPEG's SOS scan header declares spectral selection (Ss/Se) or successive-approximation (Ah/Al) parameters outside the ranges allowed by the JPEG spec. It indicates the stream violates progressive-scan constraints and cannot be decoded safely.","triggerScenarios":"Decoding a progressive JPEG whose scan header has Ss > Se, Se > 63, Ss = 0 with Se != 0 for AC scans, invalid DC scan ranges, or Ah/Al not in 0-15; feeding a corrupted or fuzzed progressive JPEG to Image.Load/Image.Identify.","commonSituations":"User uploads of damaged progressive JPEGs; thumbnails extracted from truncated progressive files; files produced by broken encoders or tools that rewrite only part of a progressive stream.","solutions":["Treat the file as malformed: discard it or re-obtain it; the stream's scan headers are invalid.","Wrap decode calls in try-catch for InvalidImageContentException and fall back to another decoder or a placeholder image.","Re-encode the source with a conformant tool to produce valid progressive (or baseline) scans before processing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// try\n{\n    using Image image = Image.Load(stream);\n}\ncatch (InvalidImageContentException ex)\n{\n    logger.LogWarning(ex, \"Invalid progressive scan parameters, skipping file\");\n}","preventionTips":["Treat progressive JPEGs from untrusted sources as suspect and validate before decode.","Keep per-file error isolation in batch pipelines.","Re-encode through a conformant encoder when files come from unknown producers."],"tags":["jpeg","progressive-jpeg","decoding","corrupt-data"],"backgroundTag":"value-out-of-range","analyzedSha":"59ce6af6fc29027cda277ef62d4d1694a8acce91","analyzedAt":"2026-09-13T18:34:59.331Z","contentChangedAt":"2026-09-13T18:34:59.331Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}