Bug 1485282 - There is a reachable assertion abort in function jpc_floorlog2() of JasPer that will lead to remote denial of service attack.
Summary: There is a reachable assertion abort in function jpc_floorlog2() of JasPer th...
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: jasper
Version: 7.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Josef Ridky
QA Contact: Desktop QE
Depends On:
Blocks: CVE-2017-13747
TreeView+ depends on / blocked
Reported: 2017-08-25 09:20 UTC by owl337
Modified: 2020-02-28 10:28 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-02-28 10:28:02 UTC
Target Upstream Version:

Attachments (Terms of Use)
Triggered by "./imginfo -f POC5" (416 bytes, application/x-rar)
2017-08-25 09:20 UTC, owl337
no flags Details

Description owl337 2017-08-25 09:20:54 UTC
Created attachment 1318067 [details]
Triggered by  "./imginfo -f POC5"

Description of problem:

There is a reachable assertion abort in function jpc_floorlog2() of JasPer that will lead to remote denial of service attack.

Version-Release number of selected component (if applicable):

<= latest version

How reproducible:

./imginfo -f POC5

Steps to Reproduce:

The output information is as follows:

$ ./imginfo -f POC5
warning: trailing garbage in marker segment (16 bytes)
imginfo: /home/icy/secreal/jasper/src/libjasper/jpc/jpc_math.c:94: int jpc_floorlog2(int): Assertion `x > 0' failed.
Aborted (core dumped)

The gdb debugging information is listed below:
(gdb) set args POC5
(gdb) r 
(gdb) r 
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/icy/secreal/jasper/install/bin/imginfo -f fuzz/output/crashes/id:000178,sig:06,src:002952,op:havoc,rep:16 
c warning: trailing garbage in marker segment (16 bytes)

Breakpoint 7, jpc_floorlog2 (x=1) at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_math.c:94
94		assert(x > 0);
(gdb) c 9992
Will ignore next 9991 crossings of breakpoint 7.  Continuing.

Breakpoint 7, jpc_floorlog2 (x=0) at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_math.c:94
94		assert(x > 0);

(gdb) n
imginfo: /home/icy/secreal/jasper/src/libjasper/jpc/jpc_math.c:94: int jpc_floorlog2(int): Assertion `x > 0' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff71f8428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff71f8428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff71fa02a in __GI_abort () at abort.c:89
#2  0x00007ffff71f0bd7 in __assert_fail_base (fmt=<optimized out>, 
    assertion=assertion@entry=0x7ffff7bbd2b7 "x > 0", 
    file=file@entry=0x7ffff7bc161d "/home/icy/secreal/jasper/src/libjasper/jpc/jpc_math.c", 
    line=line@entry=94, function=function@entry=0x7ffff7bc1653 "int jpc_floorlog2(int)") at assert.c:92
#3  0x00007ffff71f0c82 in __GI___assert_fail (assertion=0x7ffff7bbd2b7 "x > 0", 
    file=0x7ffff7bc161d "/home/icy/secreal/jasper/src/libjasper/jpc/jpc_math.c", line=94, 
    function=0x7ffff7bc1653 "int jpc_floorlog2(int)") at assert.c:101
#4  0x00007ffff7b5fc37 in jpc_floorlog2 (x=0) at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_math.c:94
#5  0x00007ffff7b9d550 in jpc_dec_decodepkt (dec=<optimized out>, pkthdrstream=<optimized out>, 
    in=<optimized out>, compno=<optimized out>, rlvlno=<optimized out>, prcno=<optimized out>, 
    lyrno=<optimized out>) at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2dec.c:314
#6  jpc_dec_decodepkts (dec=<optimized out>, pkthdrstream=<optimized out>, in=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_t2dec.c:454
#7  0x00007ffff7b44f46 in jpc_dec_process_sod (dec=<optimized out>, ms=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_dec.c:627
#8  0x00007ffff7b49ceb in jpc_dec_decode (dec=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_dec.c:424
#9  jpc_decode (in=<optimized out>, optstr=<optimized out>)
---Type <return> to continue, or q <return> to quit---
    at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_dec.c:261
#10 0x00007ffff7b059ce in jas_image_decode (in=<optimized out>, fmt=<optimized out>, optstr=<optimized out>)
    at /home/icy/secreal/jasper/src/libjasper/base/jas_image.c:442
#11 0x0000000000401bab in main (argc=<optimized out>, argv=<optimized out>)
    at /home/icy/secreal/jasper/src/appl/imginfo.c:238

Trigged in:
jpc_floorlog2 (x=1) at /home/icy/secreal/jasper/src/libjasper/jpc/jpc_math.c:94
94		assert(x > 0);
(gdb) list 
89	int jpc_floorlog2(int x)
90	{
91		int y;
93		/* The argument must be positive. */
94		assert(x > 0);
96		y = 0;
97		while (x > 1) {
98			x >>= 1;

Actual results:


Expected results:


Additional info:


This vulnerability is detected by team OWL337, with our custom fuzzer collAFL. Please contact ganshuitao@gmail.com   and chaoz@tsinghua.edu.cn if you need more info about the team, the tool or the vulnerability.

Comment 2 Josef Ridky 2017-08-25 10:37:21 UTC
Thank you for taking the time to report this issue to us. We appreciate the feedback and use reports such as this one to guide our efforts at improving our products. That being said, this bug tracking system is not a mechanism for requesting support, and we are not able to guarantee the timeliness or suitability of a resolution.

If this issue is critical or in any way time sensitive, please raise a ticket through the regular Red Hat support channels to ensure it receives the proper attention and prioritization to assure a timely resolution. 

For information on how to contact the Red Hat production support team, please visit:

For proper identification of issue are required properly filled following information:

- Description of problem
- Version-Release number of selected component (if applicable)
- Steps to Reproduce
- Actual results
- Expected results
- Additional info

Comment 3 Tomas Hoger 2017-09-20 12:49:21 UTC
The assertion failure in jpc_floorlog2() was previously reported as CVE-2016-9398 (bug 1396980) and is tracked upstream via this issue report:


Code paths leading to the assertion using your test case and the one in the report for CVE-2016-9398 are mostly the same.  Can you provide reasoning why the new CVE is required / justified here?  If you agree this is a dupe of the earlier CVE, please get the new CVE rejected as duplicate (similar to CVE-2017-13753).

Comment 4 owl337 2017-11-13 12:16:27 UTC
Did you make sure the two trigger paths exactly the same?

Comment 5 Tomas Hoger 2017-11-13 12:26:33 UTC
As you requested the new CVE, it's *your* responsibility to ensure it's not a dupe of an existing one.

Comment 6 owl337 2017-11-28 11:26:25 UTC
ok,thanks for your remind.

Comment 7 Josef Ridky 2020-02-28 10:28:02 UTC
This vulnerability was evaluated by the sub-system, taking into account the kind of the component, and its use cases. It was not considered as a priority for the next release, so it's being closed now as WONTFIX. Feel free to re-open the bug if there is a business reason to deliver a fix for this issue, and contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification. Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:


Note You need to log in before you can comment on or make changes to this bug.