pub fn try_patch_invalid_height(input: &[u8]) -> Option<Vec<u8>>Expand description
Detect and attempt to fix JPEG data with a known bad header where height is 0xFFFF.
Some malformed JPEG encoders set the image height to 0xFFFF in the SOF marker. This function checks known byte offsets for this pattern and, if found, patches the height to 0 (which per JPEG spec means “determine from data/DNL marker”).
Returns Some(patched_data) if the known bad pattern was found and patched,
None if the data doesn’t match the known bad pattern.