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 opening 358MPix Tiff #670

Merged
merged 8 commits into from
Sep 7, 2014
Merged

Conversation

LebedevRI
Copy link
Member

With following changes DT can now open 358MPix Tiff file produced by Hugin:

[tiff_open] 26770x13385 16bpp, 4 samples per pixel.

I also tested it on all combinations of TIFF's DT can produce - no regressions.
Also some generic cleanup.

TODO: BigTIFF support.

@LebedevRI
Copy link
Member Author

I do not think this breaks anything, so unless there is any comment, i'm planning on merging this in +~24h

LebedevRI added a commit that referenced this pull request Sep 7, 2014
@LebedevRI LebedevRI merged commit 801dadc into darktable-org:master Sep 7, 2014
@LebedevRI LebedevRI deleted the tiff-358mpix branch September 7, 2014 18:37
@LebedevRI LebedevRI modified the milestone: 1.5 Oct 21, 2014
LebedevRI added a commit to llvm/llvm-project that referenced this pull request Apr 13, 2021
Overflows are never fun.
In most cases (in most of the code), they are rare,
because usually you e.g. don't have as many elements.

However, it's exceptionally easy to fall into this pitfail
in code that deals with images, because, assuming 4-channel 32-bit FP data,
you need *just* ~269 megapixel image to case an overflow
when computing at least the total byte count.

In [[ https://github.com/darktable-org/darktable | darktable ]], there is a *long*, painful history of dealing with such bugs:
* darktable-org/darktable#7740
* darktable-org/darktable#7419
* darktable-org/darktable@eea1989
* darktable-org/darktable@70626dd
* darktable-org/darktable#670
* darktable-org/darktable@38c69fb

and yet they clearly keep resurfacing still.

It would be immensely helpful to have a diagnostic for those patterns,
which is what this change proposes.

Currently, i only diagnose the most obvious case, where multiplication
is directly widened with no other expressions inbetween,
(i.e. `long r = (int)a * (int)b` but not even e.g. `long r = ((int)a * (int)b)`)
however that might be worth relaxing later.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D93822
arichardson pushed a commit to arichardson/llvm-project that referenced this pull request Sep 10, 2021
Overflows are never fun.
In most cases (in most of the code), they are rare,
because usually you e.g. don't have as many elements.

However, it's exceptionally easy to fall into this pitfail
in code that deals with images, because, assuming 4-channel 32-bit FP data,
you need *just* ~269 megapixel image to case an overflow
when computing at least the total byte count.

In [[ https://github.com/darktable-org/darktable | darktable ]], there is a *long*, painful history of dealing with such bugs:
* darktable-org/darktable#7740
* darktable-org/darktable#7419
* darktable-org/darktable@eea1989
* darktable-org/darktable@70626dd
* darktable-org/darktable#670
* darktable-org/darktable@38c69fb

and yet they clearly keep resurfacing still.

It would be immensely helpful to have a diagnostic for those patterns,
which is what this change proposes.

Currently, i only diagnose the most obvious case, where multiplication
is directly widened with no other expressions inbetween,
(i.e. `long r = (int)a * (int)b` but not even e.g. `long r = ((int)a * (int)b)`)
however that might be worth relaxing later.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D93822
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Overflows are never fun.
In most cases (in most of the code), they are rare,
because usually you e.g. don't have as many elements.

However, it's exceptionally easy to fall into this pitfail
in code that deals with images, because, assuming 4-channel 32-bit FP data,
you need *just* ~269 megapixel image to case an overflow
when computing at least the total byte count.

In [[ https://github.com/darktable-org/darktable | darktable ]], there is a *long*, painful history of dealing with such bugs:
* darktable-org/darktable#7740
* darktable-org/darktable#7419
* darktable-org/darktable@eea1989
* darktable-org/darktable@70626dd
* darktable-org/darktable#670
* darktable-org/darktable@38c69fb

and yet they clearly keep resurfacing still.

It would be immensely helpful to have a diagnostic for those patterns,
which is what this change proposes.

Currently, i only diagnose the most obvious case, where multiplication
is directly widened with no other expressions inbetween,
(i.e. `long r = (int)a * (int)b` but not even e.g. `long r = ((int)a * (int)b)`)
however that might be worth relaxing later.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D93822
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.

1 participant