diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-28 12:05:12 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-28 12:05:12 +0000 |
commit | a4d3565c4a5c01f584ba25f62647685f6c4a9aa2 (patch) | |
tree | c9622c57312057e474225ce28a64bf2dad4afc45 | |
parent | d4746b5deb8b675a6e0576a89a412f6e24a8c2bd (diff) |
* merge -c 11935
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@11937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | pack.c | 23 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 22 insertions, 9 deletions
@@ -1,3 +1,9 @@ +Wed Feb 28 20:51:32 2007 URABE Shyouhei <shyouhei@ruby-lang.org> + + * pack.c (pack_unpack): properly ignore non-base64 octets such as + UTF-8 encoded BOMs; submitted by SOUMA Yutaka <holon@radastery.jp> + to fix [ruby-core:10437] + Wed Feb 28 00:08:11 2007 URABE Shyouhei <shyouhei@ice.uec.ac.jp> * mkconfig.rb (RbConfig): add CONFIG['PATCHLEVEL'] @@ -1803,20 +1803,27 @@ pack_unpack(str, fmt) } } while (s < send) { - while (s[0] == '\r' || s[0] == '\n') { s++; } - if ((a = b64_xtable[(int)s[0]]) == -1) break; - if ((b = b64_xtable[(int)s[1]]) == -1) break; - if ((c = b64_xtable[(int)s[2]]) == -1) break; - if ((d = b64_xtable[(int)s[3]]) == -1) break; + a = b = c = d = -1; + while((a = b64_xtable[(int)(*(unsigned char*)s)]) == -1 && s < send) { s++; } + if( s >= send ) break; + s++; + while((b = b64_xtable[(int)(*(unsigned char*)s)]) == -1 && s < send) { s++; } + if( s >= send ) break; + s++; + while((c = b64_xtable[(int)(*(unsigned char*)s)]) == -1 && s < send) { if( *s == '=' ) break; s++; } + if( *s == '=' || s >= send ) break; + s++; + while((d = b64_xtable[(int)(*(unsigned char*)s)]) == -1 && s < send) { if( *s == '=' ) break; s++; } + if( *s == '=' || s >= send ) break; + s++; *ptr++ = a << 2 | b >> 4; *ptr++ = b << 4 | c >> 2; *ptr++ = c << 6 | d; - s += 4; } if (a != -1 && b != -1) { - if (s + 2 < send && s[2] == '=') + if (c == -1 && *s == '=') *ptr++ = a << 2 | b >> 4; - if (c != -1 && s + 3 < send && s[3] == '=') { + else if (c != -1 && *s == '=') { *ptr++ = a << 2 | b >> 4; *ptr++ = b << 4 | c >> 2; } @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2007-02-28" #define RUBY_VERSION_CODE 185 #define RUBY_RELEASE_CODE 20070228 -#define RUBY_PATCHLEVEL 23 +#define RUBY_PATCHLEVEL 24 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 |