php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39908 base64 decoding's memory garbage
Submitted: 2006-12-20 17:18 UTC Modified: 2006-12-20 20:11 UTC
From: herbert dot fischer at gmail dot com Assigned:
Status: Closed Package: Strings related
PHP Version: 5.2.0 OS: Linux RedHat AS3/AS4
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: herbert dot fischer at gmail dot com
New email:
PHP Version: OS:

 

 [2006-12-20 17:18 UTC] herbert dot fischer at gmail dot com
Description:
------------
I'm having issues trying to base64_decode the encoded string . I tested in a lot of php and linux versions and on some got the error and on another didn't. Mostly the problem seams to be on PHP 5.X

QkVHSU46VkNBTEVOREFSDQpQUk9ESUQ6LS8vR29vZ2xlIEluYy8vR29vZ2xlIENhbGVuZGFyIDcw
LjkwNTQvL0VODQpWRVJTSU9OOjIuMA0KQ0FMU0NBTEU6R1JFR09SSUFODQpNRVRIT0Q6UkVRVUVT
VA0KQkVHSU46VkVWRU5UDQpEVFNUQVJUOjIwMDYxMjE5VDIyMDAwMFoNCkRURU5EOjIwMDYxMjIw
VDAzMDAwMFoNCkRUU1RBTVA6MjAwNjEyMTlUMTc1NjA4Wg0KT1JHQU5JWkVSO0NOPUhlcmJlcnQg
RmlzY2hlcjpNQUlMVE86aGVyYmVydC5maXNjaGVyQGdtYWlsLmNvbQ0KVUlEOmI5dWdhNjdwMjNn
Z21ibG1uYW05bXM0bTlvQGdvb2dsZS5jb20NCkFUVEVOREVFO0NVVFlQRT1JTkRJVklEVUFMO1JP
TEU9UkVRLVBBUlRJQ0lQQU5UO1BBUlRTVEFUPUFDQ0VQVEVEO1JTVlA9VFJVRQ0KIDtDTj1IZXJi
ZXJ0IEZpc2NoZXI7WC1OVU0tR1VFU1RTPTA6TUFJTFRPOmhlcmJlcnQuZmlzY2hlckBnbWFpbC5j
b20NC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byBubyBtb21lbnRvIGRvIHNvcg0KIHRlaW9cLCBhbD9tIGRv
cyBwcj9taW9zIGNpdGFkb3MgYWNpbWFcLCBpcj9vIGNvbmNvcnJlciBoPyB1bSBwcj9taW8gZXNw
ZWNpYQ0KIGwuXG5cbkNvbXBhcmU/YW0gYSBjb25mcmF0ZXJuaXphPz9vXCwgcXVlIHM/IHNlcj8g
IHVtIHN1Y2Vzc28gY29tIHN1YSBwcmVzZQ0KIG4/YSEhIVxuVmlzdWFsaXplIHNldSBldmVudG8g
ZW0gaHR0cDovL3d3dy5nb29nbGUuY29tL2NhbGVuZGFyL2V2ZW50P2FjdGlvbg0KID1WSUVXJmVp
ZD1ZamwxWjJFMk4zQXlNMmRuYldKc2JXNWhiVGx0Y3pSdE9XOGdiV0ZwYkVCb1oyWnBjMk5vWlhJ
dWJHOWpZWGRsWQ0KIGk1amIyMHVZbkkmdG9rPU1qVWphR1Z5WW1WeWRDNW1hWE5qYUdWeVFHZHRZ
V2xzTG1OdmJXWm1aVGd4TWpFd09ETmtZek16TlRsaw0KIE5HTm1ORFEwTVRZellqVTNNV0kyWVRj
ek1tWm1PVGsmY3R6PUFtZXJpY2ElMkZBcmdlbnRpbmElMkZCdWVub3NfQWlyZXMmaGw9cA0KIHRf
QlIuDQpMQVNULU1PRElGSUVEOjIwMDYxMjE5VDE3NTYwOFoNCkxPQ0FUSU9OOjAxMSBFdmVudG9z
DQpTRVFVRU5DRTowDQpTVEFUVVM6Q09ORklSTUVEDQpTVU1NQVJZOkZlc3RhIGRhIExvY2FXZWIN
ClRSQU5TUDpPUEFRVUUNCkVORDpWRVZFTlQNCkVORDpWQ0FMRU5EQVINCg==";

$res = base64_decode($var);
echo ($res === false) ? "NOPE\n" : "===\n$res\n===\n";

$res = mb_convert_encoding($var, 'ISO-8859-1', 'BASE64');
echo ($res === false) ? "NOPE\n" : "===\n$res\n===\n";

$res = iconv('BASE64', 'ISO-8859-1', $res);
echo ($res === false) ? "NOPE\n" : "===\n$res\n===\n";
?>


Expected result:
----------------
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20061219T220000Z
DTEND:20061220T030000Z
DTSTAMP:20061219T175608Z
ORGANIZER;CN=Herbert Fischer:MAILTO:herbert.fischer@gmail.com
UID:b9uga67p23ggmblmnam9ms4m9o@google.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE
 ;CN=Herbert Fischer;X-NUM-GUESTS=0:MAILTO:herbert.fischer@gmail.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
 TRUE;CN=mail@hgfischer.locaweb.com.br;X-NUM-GUESTS=0:MAILTO:mail@hgfischer.
 locaweb.com.br
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;RSVP=TRU
 E;CN=herbert.fischer@locaweb.com.br;X-NUM-GUESTS=0:MAILTO:herbert.fischer@l
 ocaweb.com.br
CLASS:PRIVATE
CREATED:20061219T150739Z
DESCRIPTION:Chegou o grande dia da nossa Confraterniza??o\, que ter? in?cio
  ?s 19hs no 011 eventos (Rua Alvorada\, 1035 - Itaim Bibi - <a rel=nofollow
  href="http://www.011eventos.com.br" class=linkified target=_blank>www.011e
 ventos.com.br</a
K[X]YHE\[\E\H?E[U[U?[?.\nAl?m de um
 a balada completa com direito a servi?o de buffet\, open bar\, DJ\, pista d
 e dan?a\, som da mais alta qualidade\, teremos o sorteio de 44 brindes\, en
 tre  televisores\, bicicletas\, aparelhos de DVD\, home theater e MP3!\nOs
 funcion?rios do per?odo noturno que estiverem trabalhando no momento do sor
 teio\, al?m dos pr?mios citados acima\, ir?o concorrer h? um pr?mio especia
 l.\n\nCompare?am a confraterniza??o\, que s? ser?  um sucesso com sua prese
 n?a!!!\nVisualize seu evento em http://www.google.com/calendar/event?action
 =VIEW&eid=Yjl1Z2E2N3AyM2dnbWJsbW5hbTltczRtOW8gbWFpbEBoZ2Zpc2NoZXIubG9jYXdlY
 i5jb20uYnI&tok=MjUjaGVyYmVydC5maXNjaGVyQGdtYWlsLmNvbWZmZTgxMjEwODNkYzMzNTlk
 NGNmNDQ0MTYzYjU3MWI2YTczMmZmOTk&ctz=America%2FArgentina%2FBuenos_Aires&hl=p
 t_BR.
LAST-MODIFIED:20061219T175608Z
LOCATION:011 Eventos
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Festa da LocaWeb
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

Actual result:
--------------
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20061219T220000Z
DTEND:20061220T030000Z
DTSTAMP:20061219T175608Z
ORGANIZER;CN=Herbert Fischer:MAILTO:herbert.fischer@gmail.com
UID:b9uga67p23ggmblmnam9ms4m9o@google.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE
 ;CN=Herbert Fischer;X-NUM-GUESTS=0:MAILTO:herbert.fischer@gmail.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
 TRUE;CN=mail@hgfischer.locaweb.com.br;X-NUM-GUESTS=0:MAILTO:mail@hgfischer.
 locaweb.com.br
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;RSVP=TRU
 E;CN=herbert.fischer@locaweb.com.br;X-NUM-GUESTS=0:MAILTO:herbert.fischer@l
 ocaweb.com.br
CLASS:PRIVATE
CREATED:20061219T150739Z
DESCRIPTION:Chegou o grande dia da nossa Confraterniza??o\, que ter? in?cio
  ?s 19hs no 011 eventos (Rua Alvorada\, 1035 - Itaim Bibi - <a rel=nofollow
  href="http://www.011eventos.com.br" class=linkified target=_blank>www.011e
 ventos.com.br</a
K?[X???]YH?\[?\?\?H???[??[ۏܚ[?˗?[?HH[CB?H?[YH??\]H??H\?Z]?H?\??O??H?Y??]?[??\??\?HB?H[??W??HHXZ\?[H]X[YYW\?[[????ܝZ[?H

??[?\?[?B??H[]?\?ܙ\??X?X?]\?\\?[??H??YHX]\?HT?W???B??[??[ۏܚ[???\??????\???]YH\?]?\?[H?X?[[????[?Y[????܃B?Z[?[?H????Z[???]Y??X?[XW\????ۘ?ܜ?\??[H??Z[?\?X?XCB??????\\?O?[HH?ۙ??]\??^?O???]YH???\??[H?X?\?????H?XH?\?CB???HHHW??\?X[^?H?]H]?[??[H?????˙????K???K??[[?\??]?[??X?[ۃB?U?QUəZYVZ?V??L???^SL???Ҝؕ?Z?ޔ???ؕќ?P?֌??̓?֖]X??Z?VCB?MZ???V[?I???SZ?Z?Q՞V[U?Y?[XV??Q՞TQ?U??S???֛V??Z?]????^?^???B??ӛS?LU^?Z?L?U?L?Uޓ[V?S?ɘ??P[Y\?X?IL??\??[?[?IL???Y[????Z\?\ɚ\B?Д??B?T?SS?Q?QQ??
?L?NUM?M??B???USӎ?LH]?[???B??TUQS??N?B??UTΐ?ӑ?T?QQB??SSPT?N??\?HH??U?X?B??S????TUQCB?S???U?S?B?S????SS?T?B

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-20 17:44 UTC] tony2001@php.net
Please provide a working reproduce code, using the code above I can see only "bool(false)".
 [2006-12-20 19:38 UTC] herbert dot fischer at gmail dot com
Yes! "False" (and not only false) because base64_decode cannot even decode this encoded string sometimes. mb_convert_encoding did decode, but with lots of garbage. Sometimes base64_decode decoded with garbage just like mb_convert_encoding did, without returning just "false".

=========================== b64.php ==========================
<?php
$var = "QkVHSU46VkNBTEVOREFSDQpQUk9ESUQ6LS8vR29vZ2xlIElu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CwgcXVlIHM/IHNlcj8g
IHVtIHN1Y2Vzc28gY29tIHN1YSBwcmVzZQ0KIG4/YSEhIVxuVmlzdWFsaXplIHNldSBldmVudG8g
ZW0gaHR0cDovL3d3dy5nb29nbGUuY29tL2NhbGVuZGFyL2V2ZW50P2FjdGlvbg0KID1WSUVXJmVp
ZD1ZamwxWjJFMk4zQXlNMmRuYldKc2JXNWhiVGx0Y3pSdE9XOGdiV0ZwYkVCb1oyWnBjMk5vWlhJ
dWJHOWpZWGRsWQ0KIGk1amIyMHVZbkkmdG9rPU1qVWphR1Z5WW1WeWRDNW1hWE5qYUdWeVFHZHRZ
V2xzTG1OdmJXWm1aVGd4TWpFd09ETmtZek16TlRsaw0KIE5HTm1ORFEwTVRZellqVTNNV0kyWVRj
ek1tWm1PVGsmY3R6PUFtZXJpY2ElMkZBcmdlbnRpbmElMkZCdWVub3NfQWlyZXMmaGw9cA0KIHRf
QlIuDQpMQVNULU1PRElGSUVEOjIwMDYxMjE5VDE3NTYwOFoNCkxPQ0FUSU9OOjAxMSBFdmVudG9z
DQpTRVFVRU5DRTowDQpTVEFUVVM6Q09ORklSTUVEDQpTVU1NQVJZOkZlc3RhIGRhIExvY2FXZWIN
ClRSQU5TUDpPUEFRVUUNCkVORDpWRVZFTlQNCkVORDpWQ0FMRU5EQVINCg==";

$res = base64_decode($var);
echo ($res === false) ? "NOPE\n" : "===\n$res\n===\n";

$res = mb_convert_encoding($var, 'UTF-8', 'BASE64');
echo ($res === false) ? "NOPE\n" : "===\n$res\n===\n";
?>
====================== end of b64.php =====================

Decoding the encoded text with other means, works. Tested with a Perl script, http://makcoder.sourceforge.net/demo/base64.php, etc.
 [2006-12-20 20:08 UTC] tony2001@php.net
I don't get it. So what's the problem? base64_decode() is unable to decode broken/invalid data, that's expected.
Other means, like libmbfl (used in ext/mbstring) may try to decode it and get a garbage instead. Which is also expected.
What is the problem?
 [2006-12-20 20:11 UTC] herbert dot fischer at gmail dot com
Sorry for the mess. Just found that the encoded string was loosing a single "+" during a POST (in url-encoded format).
Please, close this. Bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC