mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2024-12-22 23:08:13 +01:00
Harden against badly-compressed data
This commit is contained in:
parent
f28e87cbac
commit
c6a0c057b8
@ -25,7 +25,7 @@ let recompress_stream pdf = function
|
||||
| Some (Pdf.Array []
|
||||
| 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
|
||||
| _ -> ()
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user