mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
Harden against badly-compressed data
This commit is contained in:
@ -25,7 +25,7 @@ let recompress_stream pdf = function
|
|||||||
| Some (Pdf.Array []
|
| Some (Pdf.Array []
|
||||||
| Pdf.Array (Pdf.Name ("/ASCIIHexDecode" | "/ASCII85Decode" | "/LZWDecode" | "/RunLengthDecode")::_)
|
| Pdf.Array (Pdf.Name ("/ASCIIHexDecode" | "/ASCII85Decode" | "/LZWDecode" | "/RunLengthDecode")::_)
|
||||||
)), _ ->
|
)), _ ->
|
||||||
Pdfcodec.decode_pdfstream_until_unknown pdf stream;
|
begin try Pdfcodec.decode_pdfstream_until_unknown pdf stream with _ -> Pdfe.log "Warning: Skipping re-encoding of a stream\n" end;
|
||||||
Pdfcodec.encode_pdfstream ~only_if_smaller:true pdf Pdfcodec.Flate stream
|
Pdfcodec.encode_pdfstream ~only_if_smaller:true pdf Pdfcodec.Flate stream
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user