Bug 18155 - Regex.Match Crashes App
Summary: Regex.Match Crashes App
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.12.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-03-04 10:02 UTC by Roy Deistung
Modified: 2014-11-23 23:15 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
testdata (7.84 KB, text/plain)
2014-03-04 10:03 UTC, Roy Deistung
Details
log of around the moment of crash (46.82 KB, text/plain)
2014-03-05 09:37 UTC, Roy Deistung
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Roy Deistung 2014-03-04 10:02:40 UTC
Match validBase64 = Regex.Match(encodedData, @"(([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?){1}");

the app crashes with out any exception or any information when giving long input data.
On Windows it works fine with the same data.

See attachment for example data that works on windows but does not work on android.
Comment 1 Roy Deistung 2014-03-04 10:03:10 UTC
Created attachment 6210 [details]
testdata
Comment 2 Udham Singh 2014-03-04 13:25:34 UTC
I have tried to reproduce this issue and implemented the code given into the bug description.
I have checked it on both XS and VS but it is not giving any exception and application is working fine.
Please refer the screencast:

For XS (Android app): http://screencast.com/t/x4iBH8aq
For VS (Android app): http://screencast.com/t/pAQc89SM

Environment Info:

Windows 8.1
VS 2012
XS 4.2.3.59
Xamarin.Android 4.12.00028

Please let me know if I am missing any thing.
Comment 3 Roy Deistung 2014-03-05 09:36:21 UTC
works in a new application, fails in existing one. 
I tried to find any clues to that via the ADT logging, but it only says "app died"

for now I will use a workaround:

  String allowedChars = "qwertzuioplkjhgfdsayxcvbnmQWERTZUIOPLKJHGFDSAYXCVBNM1234567890+/=";
            Boolean isValid = true;

            foreach (var currentChar in encodedData.ToCharArray())
            {
                if (!allowedChars.Contains(currentChar))
                {
                    isValid = false;
                    return isValid;
                }
            }

if you want to have a look I added the logg of a crash. (the app is called MinervaMobile)
Comment 4 Roy Deistung 2014-03-05 09:37:10 UTC
Created attachment 6227 [details]
log of around the moment of crash
Comment 5 Miguel de Icaza [MSFT] 2014-11-23 23:15:04 UTC
Unable to reproduce with either Mono or the new .NET stack code.