Bug 1464635 - SEGV in chm_http
Summary: SEGV in chm_http
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: chmlib
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Peter Lemenkov
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-24 02:26 UTC by Przemek Klosowski
Modified: 2018-11-30 18:15 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-30 18:15:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
chm file to demonstrate the crash (240.25 KB, application/octet-stream)
2017-06-24 02:26 UTC, Przemek Klosowski
no flags Details

Description Przemek Klosowski 2017-06-24 02:26:26 UTC
Created attachment 1291319 [details]
chm file to demonstrate the crash

Description of problem:
chm_http gets frequent SEGV crashes

Version-Release number of selected component (if applicable):
chmlib-0.40-13.fc24.x86_64


How reproducible: every time


Steps to Reproduce:
1. run on a random .chm file:    chm_http e.chm
2. point browser to localhost:8080
3. click on links in the file

Actual results: segv crash
0x0000555555555654 in service_request (fd=<optimized out>, file=0x555555768010) at chm_http.c:357
357	    if (strncmp(end+1, "HTTP", 4) == 0)


Expected results: no crash, correct operation


Additional info: I suspect that it doesn't matter which .CHM file to use, but just in case, I include the one I tried to read

Comment 1 Przemek Klosowski 2017-06-24 02:36:35 UTC
The code in service_request():356 :
    end = strrchr(buffer, ' ');
    if (strncmp(end+1, "HTTP", 4) == 0)

is incorrect because strrchr() can return NULL if the string is not found, causing the NULL dereference in the next line.

I observed this when buffer is read as empty (i.e. it contains only NULLs).
The correct code should probably explicitly check for that null:

    end = strrchr(buffer, ' ');
    if (!end && strncmp(end+1, "HTTP", 4) == 0)

although in that case service_request() will produce a CONTENT_500 and I am not sure if that's warranted---it's unclear when the empty buffer will appear.

Comment 2 Fedora End Of Life 2017-11-16 19:29:35 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. 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 '25'.

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 25 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.

Comment 3 Przemek Klosowski 2017-11-16 19:51:11 UTC
Still a problem in F27 chmlib-0.40-16.fc27.x86_64

Comment 4 Ben Cotton 2018-11-27 18:13:11 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. 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 '27'.

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 27 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.

Comment 5 Ben Cotton 2018-11-30 18:15:36 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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