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

fix signature begin determination #2

Merged
merged 1 commit into from
Jan 13, 2020

Conversation

ktomk
Copy link
Contributor

@ktomk ktomk commented Dec 25, 2019

previously the begin of the signature was determined based on the stub-
length.

NOTE: determining the signature begin based on manifest parser end position
can lead to overwriting the last byte of the last file in the phar
with the first byte of the hash.

this ignored the size of the manifest.

fix is to take the end of the manifest which is known due to it's size
and add the compressed file sizes to it instead of adding this to the
internal position of the parser that runs only to detect the compressed
file sizes. authoritative is the manifest size.

previously the begin of the signature was determined based on the stub-
length.

NOTE: determining the signature begin based on manifest parser end position
      can lead to overwriting the last byte of the last file in the phar
      with the first byte of the hash.

this ignored the size of the manifest.

fix is to take the end of the manifest which is known due to it's size
and add the compressed file sizes to it instead of adding this to the
internal position of the parser that runs only to detect the compressed
file sizes. authoritative is the manifest size.
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 25, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 25, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 29, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 29, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 29, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 29, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 30, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 30, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 30, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
ktomk added a commit to ktomk/pipelines that referenced this pull request Dec 30, 2019
the Timestamps class had a flaw when determining the byte-offset of the
phar signature when re-writing the signature that could (and did) lead
to overwriting the last byte of the last file with the first byte of the
signature raw hash.

upstream-pr-signature-offset: Seldaek/phar-utils#2
upstream-pr-little-endian: Seldaek/phar-utils#3
@Seldaek Seldaek merged commit be46107 into Seldaek:master Jan 13, 2020
@Seldaek
Copy link
Owner

Seldaek commented Jan 13, 2020

Just gonna assume you did your research here, because I frankly don't feel like digging into this again right now :)

@ktomk
Copy link
Contributor Author

ktomk commented Jan 14, 2020

Let's say I did my research.

And just in case for some future reference, I've tagged the commits locally where the problems arose so the revisions don't go away. It was always reproducible (when the files put into the phar are the same).

@ktomk
Copy link
Contributor Author

ktomk commented Mar 15, 2020

For future reference, I've pushed the three tags just to have this transparent:

These tags keep the revisions in the distributed Github repository of ktomk/pipelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants