Bug 19360 - System.Convert.FromBase64String throws FormatException invalid length on valid length.
Summary: System.Convert.FromBase64String throws FormatException invalid length on vali...
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-04-29 05:36 UTC by john.howard-011x634
Modified: 2014-04-29 09:58 UTC (History)
1 user (show)

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

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 GitHub or Developer Community 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:

Description john.howard-011x634 2014-04-29 05:36:15 UTC
The problem is in mono/metadata/icall.c line 7673 (2014-04-28), if ((olength & 3) != 0 || olength <= 0) {
It should be if ((olength % 4) != 0 || olength <= 0) {, because olength should be a multiple of four and not only if the two least significant bits are set.
Comment 1 john.howard-011x634 2014-04-29 05:37:55 UTC
in function static MonoArray * base64_to_byte_array (gunichar2 *start, gint ilength, MonoBoolean allowWhitespaceOnly), forgot to add that..