Bug 1943409
Summary: | CVE-2021-32491 djvulibre: Integer overflow in function render() in tools/ddjvu via crafted djvu file [fedora-all] | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | 1vanChen <houyunsong> | ||||||
Component: | djvulibre | Assignee: | Marek Kašík <mkasik> | ||||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | rawhide | CC: | tpopela | ||||||
Target Milestone: | --- | Keywords: | Security, SecurityTracking | ||||||
Target Release: | --- | ||||||||
Hardware: | x86_64 | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | djvulibre-3.5.27-24.fc32 djvulibre-3.5.27-27.fc33 | Doc Type: | If docs needed, set a value | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2021-11-25 15:21:18 UTC | Type: | Bug | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 1943684 | ||||||||
Attachments: |
|
Description
1vanChen
2021-03-26 02:04:37 UTC
Created attachment 1770218 [details]
Path fixing the integer overflow
This patch casts the computation of allocated space to size_t and also checks overflow in the range of size_t (since malloc's argument is size_t).
(In reply to Marek Kašík from comment #1) > Created attachment 1770218 [details] > Path fixing the integer overflow > > This patch casts the computation of allocated space to size_t and also > checks overflow in the range of size_t (since malloc's argument is size_t). When I apply this patch, using the default compilation parameters will produce the following error: ```shell In file included from /usr/include/c++/5/cstdint:35:0, from ddjvu.cpp:73: /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support \ ^ ddjvu.cpp: In function ‘void render(ddjvu_page_t*, int)’: ddjvu.cpp:398:26: error: ‘SIZE_MAX’ was not declared in this scope if ((size_t) rowsize > SIZE_MAX / rrect.h) ``` It seems that we need to modify the default compilation parameters. Another question: Is it necessary for us to check whether `rrect.h` is 0 to avoid division by zero errors? (In reply to 1vanChen from comment #2) > (In reply to Marek Kašík from comment #1) > > Created attachment 1770218 [details] > > Path fixing the integer overflow > > > > This patch casts the computation of allocated space to size_t and also > > checks overflow in the range of size_t (since malloc's argument is size_t). > > > When I apply this patch, using the default compilation parameters will > produce the following error: > ```shell > In file included from /usr/include/c++/5/cstdint:35:0, > from ddjvu.cpp:73: > /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file > requires compiler and library support for the ISO C++ 2011 standard. This > support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. > #error This file requires compiler and library support \ > ^ > ddjvu.cpp: In function ‘void render(ddjvu_page_t*, int)’: > ddjvu.cpp:398:26: error: ‘SIZE_MAX’ was not declared in this scope > if ((size_t) rowsize > SIZE_MAX / rrect.h) > ``` > It seems that we need to modify the default compilation parameters. Hi, could you try whether including <stdint.h> instead of <cstdint> fixes the issue? > Another question: Is it necessary for us to check whether `rrect.h` is 0 to > avoid division by zero errors? Yes, I think that we should check this because of the division. > Hi, could you try whether including <stdint.h> instead of <cstdint> fixes
> the issue?
Yes, thanks for your answer, it looks good now!
This message is a reminder that Fedora 33 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '33'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 33 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. This message is a reminder that Fedora 33 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '33'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 33 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. This message is a reminder that Fedora 33 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '33'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 33 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. This has been fixed quite some time ago (since Fedora 32). |