diff options
| author | Andrea Grazioso (agr-odoo) <agr@odoo.com> | 2019-08-12 11:08:27 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2019-08-14 11:55:53 +0000 |
| commit | f8978fc235009c12d808c59d521cca76bb9db317 (patch) | |
| tree | 59ec7ee757c87da56155a37586f9453c37e84f3c /addons/theme_bootswatch/data/theme_bootswatch_data.xml | |
| parent | 85e1d8e67f456acde1db633acb88f2c04f3a6567 (diff) | |
[FIX] odoo: zlib error in PyPDF2
Pdf files created with third party tools could trigger an exception in
several modules that attempt to manipulate them (see example below).
```
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2239, in mergePage
self._mergePage(page2)
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2277, in _mergePage
originalContent, self.pdf))
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2199, in _pushPopGS
stream = ContentStream(contents, pdf)
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2673, in __init__
stream = BytesIO(b_(stream.getData()))
File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 845, in getData
decoded._data = filters.decodeStreamData(self)
File "/usr/lib/python3/dist-packages/PyPDF2/filters.py", line 346, in decodeStreamData
data = FlateDecode.decode(data, stream.get("/DecodeParms"))
File "/usr/lib/python3/dist-packages/PyPDF2/filters.py", line 111, in decode
data = decompress(data)
File "/usr/lib/python3/dist-packages/PyPDF2/filters.py", line 49, in decompress
return zlib.decompress(data)
zlib.error: Error -5 while decompressing data: incomplete or truncated stream
```
This is caused by the decompression function used by default in PyPDF2
which uses a limited buffer, unable to store all the data.
The solution, as per
[zlib documentation](https://docs.python.org/3/library/zlib.html#zlib.decompressobj),
is to use an intermediate ```decompressobj``` object to handle
the decompression.
However we do not directly control the library, which is also used
multiple times in the codebase so we decided to apply a fix directly into
the core module instead of patching every call.
opw-2048029
closes odoo/odoo#35646
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons/theme_bootswatch/data/theme_bootswatch_data.xml')
0 files changed, 0 insertions, 0 deletions
