Ticket #4600 (closed defect: fixed)

Opened 14 months ago

Last modified 14 months ago

Filter Segmentation fault

Reported by: mikzyth Owned by: andrew_b
Priority: major Milestone: 4.8.33
Component: mc-core Version: 4.8.32
Keywords: filter, segv, segfault Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

If "Filter..." is set within / directory and it results to an empty panel (i.e. filter doesn't match anything - "files only" should be unchecked), mc causes a Segmentation Fault.

Attachments

mcver.txt (558 bytes) - added by mikzyth 14 months ago.
mcdata.txt (824 bytes) - added by mikzyth 14 months ago.
gdb.txt (7.5 KB) - added by mikzyth 14 months ago.

Change History

Changed 14 months ago by mikzyth

Changed 14 months ago by mikzyth

Changed 14 months ago by mikzyth

comment:1 Changed 14 months ago by zaytsev

  • Milestone changed from Future Releases to 4.8.33

comment:2 Changed 14 months ago by andrew_b

  • Owner set to andrew_b
  • Status changed from new to accepted

comment:3 Changed 14 months ago by andrew_b

  • Branch state changed from no branch to on review

Branch: 4600_filter_segfault
Initial changeset:1ac839d20c2a277d54aa00286b69f61ffeaec929

comment:4 follow-up: ↓ 6 Changed 14 months ago by zaytsev

Hmmm, maybe some extra checks too much? I get following warnings:

../../../src/filemanager/panel.c:2333:77: warning: code will never be executed [-Wunreachable-code]
 2333 |     if (panel->dir.len == 0 || panel->current < 0 || (panel->current = 0 && panel->top == 0))
      |                                                                             ^~~~~
../../../src/filemanager/panel.c:2333:72: note: silence by adding parentheses to mark code as explicitly dead
 2333 |     if (panel->dir.len == 0 || panel->current < 0 || (panel->current = 0 && panel->top == 0))
      |                                                                        ^
      |                                                                        /* DISABLES CODE */ ( )

comment:5 Changed 14 months ago by zaytsev

I pushed a fixup to remove copy & paste code, what do you think?

comment:6 in reply to: ↑ 4 Changed 14 months ago by andrew_b

Replying to zaytsev:

I get following warnings:

I must be (panel->current == 0).

Replying to zaytsev:

I pushed a fixup to remove copy & paste code, what do you think?

Let's do that in the cleanup branch (after new indentation?).

comment:7 Changed 14 months ago by zaytsev

  • Votes for changeset set to zaytsev
  • Branch state changed from on review to approved

But why first introduce duplicate code, and then remove it in cleanup? Please keep it if you agree with the code, it relates to this branch, and makes it harder to review otherwise.

comment:8 Changed 14 months ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from zaytsev to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

I kept the code duplication removal, but in another way.

Merged to master: [b46e813120af1da0aa3afb8e983630dbc6a9471f].

git log --oneline 65fee2daf..b46e81312

comment:9 Changed 14 months ago by andrew_b

  • Status changed from testing to closed

comment:10 Changed 14 months ago by zaytsev

Thank you! Your way is better.

comment:11 Changed 14 months ago by mikzyth

Thank you for your work on Midnight Commander and quick fix!

Note: See TracTickets for help on using tickets.