Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolves #1048 flaw in generating gradient pattern key #1049

Merged
merged 4 commits into from
Dec 6, 2017

Conversation

jacksop
Copy link
Contributor

@jacksop jacksop commented Nov 23, 2017

Packing gradient attributes down to 8-bit values causes collisions when generating the SHA1 digest.

Concatinate the gradient attributes into a string in order to calculate the digest for the key.

Packing gradient attributes down to 8-bit values causes collisions when generating the SHA1 digest.

Concatinate the gradient attributes into a string in order to calculate the digest for the key.
@jacksop
Copy link
Contributor Author

jacksop commented Nov 23, 2017

Had an issue with the manual spec. Not sure why the hash has changed 🤔

@pointlessone
Copy link
Member

I think, gradient IDs changed with this PR. So the manual has changed as well. Make sure those are the only changes.

Due to gradient ID changes.
@jacksop
Copy link
Contributor Author

jacksop commented Nov 24, 2017

Produced the manual in both Ruby and JRuby to confirm no unexpected changes. The following is a diff from the Ruby produced pdf.

--- a/new_man.pdf
+++ b/old_man.pdf
@@ -28295,37 +28295,37 @@ S
 [] 0 d
 10 w
 /Pattern cs
-/SPb2ac70e4092a30e61b731f0ddcce5d2504387e26 scn
+/SPc027eb13458c6a3a5e5bb248c66f0a9bda7e3ae5 scn
 36.0 186.0 100.0 100.0 re
 f
 /Pattern CS
-/SP9bc3d87486885cdd70bcc232bdb8390eb40b3406 SCN
+/SP143b3ff7c833028e87374381ce150c291c83c0a5 SCN
 186.0 186.0 100.0 100.0 re
 S
-/SP88db9f7dce277b8129cdf156cddfc04f1f03f97e scn
-/SPfe1deee7ddb28305363bf0b8499100bb5c6398dc SCN
+/SP1ff2cc60c143e283d45a23e66ec1471a5b7d85cf scn
+/SP4c162120d6599fd9f1e63b83fad681f42ff7e303 SCN
 336.0 186.0 100.0 100.0 re
 b
 q
 1.00000 0.00000 0.00000 1.00000 323.86797 -309.88644 cm
 q
 0.70711 0.70711 -0.70711 0.70711 0.00000 0.00000 cm
-/SPc0f96e6212ed723e20c7902080036d459b015f36 scn
+/SP6f68d2e29b15a5532c23070e22d7bd7c06bc52ee scn
 496.0 196.0 80.0 80.0 re
 f
 Q
 Q
-/SPc45c6ba25edd986cedc8481d02073dc33a93cf0b scn
+/SP8256b94b16aea0a7d1641d75dd5d8e296895f9ae scn
 36.0 36.0 100.0 100.0 re
 f
-/SPeac6fb4ee24b0a4a6337258aaeadc4b81ee57327 SCN
+/SP47d5de4ca76cc74d261d227e82a96e3f6111ff74 SCN
 186.0 36.0 100.0 100.0 re
 S
-/SPfbad10aa6625193155391a3905abf363078813bc SCN
-/SP2e5547f809c03cb6a532e7f1d432ffe3ac3d39f6 scn
+/SP7825f5024162679626a2bc82fa41f9c8145d9c1a SCN
+/SPd26d3d41fe66bcec38ce4b605d8267af56155a59 scn
 336.0 36.0 100.0 100.0 re
 b
-/SP02b2d2a7b384f69b8f0bff4a895a70c84e8b2bd5 scn
+/SPf13c6a82cfdc4418087e761196d8fb506ae16f5d scn
 486.0 36.0 100.0 100.0 re
 f
 1 w
@@ -28354,16 +28354,16 @@ endobj
 /F1.0 17 0 R
 /F3.0 11 0 R
 >>
-/Pattern << /SPb2ac70e4092a30e61b731f0ddcce5d2504387e26 97 0 R
-/SP9bc3d87486885cdd70bcc232bdb8390eb40b3406 100 0 R
-/SP88db9f7dce277b8129cdf156cddfc04f1f03f97e 103 0 R
-/SPfe1deee7ddb28305363bf0b8499100bb5c6398dc 106 0 R
-/SPc0f96e6212ed723e20c7902080036d459b015f36 112 0 R
-/SPc45c6ba25edd986cedc8481d02073dc33a93cf0b 115 0 R
-/SPeac6fb4ee24b0a4a6337258aaeadc4b81ee57327 118 0 R
-/SPfbad10aa6625193155391a3905abf363078813bc 121 0 R
-/SP2e5547f809c03cb6a532e7f1d432ffe3ac3d39f6 124 0 R
-/SP02b2d2a7b384f69b8f0bff4a895a70c84e8b2bd5 127 0 R
+/Pattern << /SPc027eb13458c6a3a5e5bb248c66f0a9bda7e3ae5 97 0 R
+/SP143b3ff7c833028e87374381ce150c291c83c0a5 100 0 R
+/SP1ff2cc60c143e283d45a23e66ec1471a5b7d85cf 103 0 R
+/SP4c162120d6599fd9f1e63b83fad681f42ff7e303 106 0 R
+/SP6f68d2e29b15a5532c23070e22d7bd7c06bc52ee 112 0 R
+/SP8256b94b16aea0a7d1641d75dd5d8e296895f9ae 115 0 R
+/SP47d5de4ca76cc74d261d227e82a96e3f6111ff74 118 0 R
+/SP7825f5024162679626a2bc82fa41f9c8145d9c1a 121 0 R
+/SPd26d3d41fe66bcec38ce4b605d8267af56155a59 124 0 R
+/SPf13c6a82cfdc4418087e761196d8fb506ae16f5d 127 0 R
 >>
 >>
 >>

@pointlessone
Copy link
Member

All changes to the manual seem to be expected.

@pointlessone
Copy link
Member

Could you please add spec that checks for collision that used to be generated?

@pointlessone pointlessone merged commit c522786 into prawnpdf:master Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants