View Issue Details

IDProjectCategoryView StatusLast Update
0001666libmicrohttpdbuild systempublic2011-03-04 10:57
Reportertmayer Assigned ToChristian Grothoff  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.7 
Summary0001666: Base64 decode fails when char is defined as unsigned char
DescriptionI compile our application with angstrom-gcc for ARM. There char is defined as unsigned char. Base64.c uses -1 to indicate the end of the encoded string. Because it is unsigned char the -1 contained in base64_digits is going to be converted to 255. This breaks the later compare.
TagsNo tags attached.
Attached Files
base64-arm-unsigned-char.patch (780 bytes)   
*** base64.c.0.9.7	2011-01-20 11:56:45.000000000 +0100
--- base64.c	2011-03-03 13:23:51.566784529 +0100
***************
*** 46,55 ****
  		char c = base64_digits[(unsigned char)*(src++)];
  		char d = base64_digits[(unsigned char)*(src++)];
  		*(dest++) = (a << 2) | ((b & 0x30) >> 4);
! 		if (c == -1)
  			break;
  		*(dest++) = ((b & 0x0f) << 4) | ((c & 0x3c) >> 2);
! 		if (d == -1)
  			break;
  		*(dest++) = ((c & 0x03) << 6) | d;
  	}
--- 46,55 ----
  		char c = base64_digits[(unsigned char)*(src++)];
  		char d = base64_digits[(unsigned char)*(src++)];
  		*(dest++) = (a << 2) | ((b & 0x30) >> 4);
! 		if (c == (char)-1)
  			break;
  		*(dest++) = ((b & 0x0f) << 4) | ((c & 0x3c) >> 2);
! 		if (d == (char)-1)
  			break;
  		*(dest++) = ((c & 0x03) << 6) | d;
  	}

Activities

tmayer

2011-03-03 14:05

reporter   ~0004280

This breaks Basic Auth

Christian Grothoff

2011-03-03 21:45

manager   ~0004281

Fixed in SVN 14577.

Issue History

Date Modified Username Field Change
2011-03-03 14:03 tmayer New Issue
2011-03-03 14:03 tmayer File Added: base64-arm-unsigned-char.patch
2011-03-03 14:05 tmayer Note Added: 0004280
2011-03-03 21:45 Christian Grothoff Note Added: 0004281
2011-03-03 21:45 Christian Grothoff Status new => resolved
2011-03-03 21:45 Christian Grothoff Resolution open => fixed
2011-03-03 21:45 Christian Grothoff Assigned To => Christian Grothoff
2011-03-04 10:57 Christian Grothoff Status resolved => closed