Anonymous | Login | Signup for a new account | 12-17-2024 10:29 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0002271 | [Quercus] | minor | always | 12-21-07 07:25 | 02-05-08 12:39 | ||||
Reporter | jang | View Status | public | ||||||
Assigned To | nam | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.1.3 | ||||||
Summary | 0002271: thinko in base_convert: doesn't always work for large bases | ||||||||
Description |
There's a bug in MathModule#base_convert - two, actually. The first is the conversion of the input value to a long result: if ('0' <= ch && ch <= '9') value = ch - '0'; else if ('a' <= ch && ch <= 'z') value = ch - 'a' + 10; else if ('A' <= ch && ch <= 'Z') value = ch - 'a' + 10; Pretty sure that last line should be, er, value = ch - 'A' + 26; (which 'a' - 10 doesn't evaluate to). On output, something similar: if (d < 10) sb.append((char) (d + '0')); else sb.append((char) (d - 10 + 'a')); is also erroneous. Additional information is a sample piece of code that demonstrates this: it'll spew out nonprintable characters occasionally. Caught this whilst hacking on Elgg to make it run under quercus; as it is, the piece of Elgg code that does this is pretty broken too :-/ but figured you'd probably want the fix anyway. Cheers, jan |
||||||||
Additional Information |
<?php $s = md5(time() . "123"); echo $s; echo "\n"; echo base_convert($s, 16, 36); ?> |
||||||||
Attached Files | |||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed. 26 unique queries executed. |