| Summary: | file crashes with segmentation fault | ||
|---|---|---|---|
| Product: | Mageia | Reporter: | Zoltan Balaton <balaton> |
| Component: | RPM Packages | Assignee: | Mageia Bug Squad <bugsquad> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | Normal | CC: | luigiwalser |
| Version: | 3 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Source RPM: | file-5.12-8.5.mga3.src.rpm | CVE: | |
| Status comment: | |||
| Bug Depends on: | 13667 | ||
| Bug Blocks: | |||
| Attachments: | rediffed version of the patch from the above comment that also applies | ||
|
Description
Zoltan Balaton
2014-07-07 23:50:30 CEST
Thanks for the report. If you can find the commit between file 5.12 and file 5.16 that fixes this, please let us know. (you can try browsing the git logs for an obvious candidate or do a git bisect) CC:
(none) =>
luigiwalser I've tried to bisect it but 5.12 from git did not crash. (It gave an error though.) It must be one of the patches then so I've tried to apply them one by one. It looks like the first crash happens after file-5.12-leak_fix.patch. I've stopped there because I think it would be easier to upgrade this package to a newer version which does not have buggy patches (say the same version mga4 has) than trying to find what's wrong with the 21 patches we have now. Well there's only a few patches after leak_fix, and only one touches softmagic.c. The leak_fix patch definitely does look incorrect (error in backporting). I believe the correct version would be: From c0c0032b9e9eb57b91fefef905a3b018bab492d9 Mon Sep 17 00:00:00 2001 From: Christos Zoulas <christos@zoulas.com> Date: Fri, 21 Feb 2014 14:32:48 +0000 Subject: [PATCH] Fix memory leak (Anatol Belski) --- src/softmagic.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/softmagic.c b/src/softmagic.c index 799e55c..170de95 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -1702,10 +1702,14 @@ mget(struct magic_set *ms, const unsigne rbuf = ms->o.buf; ms->o.buf = sbuf; if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && - file_printf(ms, m->desc, offset) == -1) + file_printf(ms, m->desc, offset) == -1) { + free(rbuf); return -1; - if (file_printf(ms, "%s", rbuf) == -1) + } + if (file_printf(ms, "%s", rbuf) == -1) { + free(rbuf); return -1; + } free(rbuf); } else ms->o.buf = sbuf; -- 1.8.5.5 As for updating to a newer file version, given all the fun that caused in Cauldron during Mageia 4 development, that absolutely will not be happening. So we'll just have to fix this. I think the corrected patch I posted above should fix your first backtrace. Can you confirm? How about your second? Created attachment 5274 [details]
rediffed version of the patch from the above comment that also applies
The patch did not apply as is but the attached rediffed version seems to fix the first crash. I could not reproduce the second one now either with or without the patch. (I don't have the exact file that caused the second crash any more.)
(In reply to Zoltan Balaton from comment #4) > Created attachment 5274 [details] > rediffed version of the patch from the above comment that also applies > > The patch did not apply as is but the attached rediffed version seems to fix > the first crash. I could not reproduce the second one now either with or > without the patch. (I don't have the exact file that caused the second crash > any more.) Yep, probably a spaces/tabs issue when trying to extract the patch from my comment. Thanks again for the report! This fix will be included in the next update. Hardware:
x86_64 =>
All pushed Status:
NEW =>
RESOLVED |