You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Gian Merlino (Jira)" <ji...@apache.org> on 2020/12/06 01:23:00 UTC

[jira] [Commented] (SUREFIRE-1865) ChecksumCalculator getSha1 does not compute checksums correctly

    [ https://issues.apache.org/jira/browse/SUREFIRE-1865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17244610#comment-17244610 ] 

Gian Merlino commented on SUREFIRE-1865:
----------------------------------------

I've raised a PR on GitHub for this. It makes the change to a UTF_8 charset too; I hope that's not a bad idea for some reason.

> ChecksumCalculator getSha1 does not compute checksums correctly
> ---------------------------------------------------------------
>
>                 Key: SUREFIRE-1865
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1865
>             Project: Maven Surefire
>          Issue Type: Bug
>            Reporter: Gian Merlino
>            Priority: Major
>
> ChecksumCalculator does the following in getSha1:
> {code}
> md.update( configValue.getBytes( ISO_8859_1 ), 0, configValue.length() );
> {code}
> This isn't using the right length, because {{configValue.length()}} is a length in characters, not bytes. This will lead to the wrong length being used for any strings that contain characters that aren't encoded in a single byte.
> Additionally, I believe that this class can be used to compute checksums on strings that fall outside the ISO_8859_1 character set, so UTF_8 would be a better choice.
> I ran into this when defining a test property that contained Cyrillic characters and emojis.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)