Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
too bad though the bug doesn't seem to get solved.

"Patches speak louder than words", as the saying goes...

I have looked into the thing and made up a tentative patch:

--- ext/Digest/MD5/MD5_orig.xs 2007-08-15 16:04:42.784446351 +0200 +++ ext/Digest/MD5/MD5.xs 2007-08-15 16:29:18.914177790 +0200 @@ -84,6 +84,8 @@ extern "C" { #define SvPVbyte SvPV #endif +#define SvPVbyte_save(sv, lp) SvPVbyte(sv_mortalcopy(sv), lp) + #ifndef dTHX #define pTHX_ #define aTHX_ @@ -613,7 +615,7 @@ add(self, ...) STRLEN len; PPCODE: for (i = 1; i < items; i++) { - data = (unsigned char *)(SvPVbyte(ST(i), len)); + data = (unsigned char *)(SvPVbyte_save(ST(i), len)); MD5Update(context, data, len); } XSRETURN(1); /* self */ @@ -707,7 +709,7 @@ md5(...) } } else if (items > 1) { - data = (unsigned char *)SvPVbyte(ST(0), len); + data = (unsigned char *)SvPVbyte_save(ST(0), len); if (len == 11 && memEQ("Digest::MD5", data, 11)) { msg = "probably called as class method"; } @@ -720,7 +722,7 @@ md5(...) } for (i = 0; i < items; i++) { - data = (unsigned char *)(SvPVbyte(ST(i), len)); + data = (unsigned char *)(SvPVbyte_save(ST(i), len)); MD5Update(&ctx, data, len); } MD5Final(digeststr, &ctx);
that seems to fix it. There are still problems with two failing tests. One of the fails can be fixed in a straightforward manner, the other one I haven't followed up yet.

If you want the fix quickly you're invited to pick it up for submission at p5p. You can mail me through my berlin.pm address for more details if you want to. Otherwise I'll come back to it later, which may be much later.

Anno


In reply to Re^3: md5_hex changes its argument by Anno
in thread md5_hex changes its argument by tinita

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-26 03:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found