Bug 1212162 - Exception handling corrupts a VLA
Summary: Exception handling corrupts a VLA
Alias: None
Product: Fedora
Classification: Fedora
Component: mingw-gcc
Version: 22
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Erik van Pienbroek
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2015-04-15 17:07 UTC by Hedayat Vatankhah
Modified: 2016-07-19 13:44 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-07-19 13:44:23 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
GNU Compiler Collection 68213 None None None Never

Description Hedayat Vatankhah 2015-04-15 17:07:36 UTC
Description of problem:
#include <iostream>
#include <cstring>
#include <sstream>
#include <stdexcept>

using namespace std;

int main(int argc, char **argv)
        int n;
        stringstream ss(argv[1]);
        ss >> n;
        cout << "N: " << n << endl;
        char tbuff[n];
                memset(tbuff, 0, n);
                throw runtime_error("ERR");
        catch (exception &e)
                cout << "Writing to VLA" << endl;
                memset(tbuff, 0, n);
                cout << "Wrote" << endl;

Compiled with: 
/usr/bin/i686-w64-mingw32-g++ -O2  test.cpp -o t

Run with wine (similar results under Windows) results in crash:
[]% ./t 100                                         
fixme:winediag:start_process Wine Staging is a testing version containing experimental patches.
fixme:winediag:start_process Please report bugs at http://bugs.wine-staging.com (instead of winehq.org).
N: 100
Writing to VLA
wine: Unhandled page fault on read access to 0x00000000 at address (nil) (thread 0009), starting debugger...
Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00000000).

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

How reproducible:

Comment 1 Richard W.M. Jones 2015-04-15 17:09:41 UTC
I guess this is a bug in one of Wine, GCC, or mingw-w64.  But not
in Fedora packaging.  You'll get a faster response by taking the
bug report to one of those upstream projects.

Comment 2 Erik van Pienbroek 2015-04-15 17:19:12 UTC
@Kai: any idea?

Comment 3 Hedayat Vatankhah 2015-04-16 06:56:33 UTC
It is not wine, since the same crash happens on Windows for a similar code. It should be either GCC (upstream GCC) or mingw (which is probably a branch of upstream code?); but I don't know exactly where should I report bugs in mingw-gcc, so I reported here (I thought there might be some Fedora specific patches also). Anyway, the bug is probably related to MinGW sjlj exception handling. If you think that I should report it upstream myself, please tell me if I should report it in GCC bugzilla or Mingw64 one.

Comment 4 Fedora End Of Life 2015-11-04 10:26:54 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. 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 '21'.

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 21 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 Fedora End Of Life 2016-07-19 13:44:23 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 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

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.