-
Notifications
You must be signed in to change notification settings - Fork 607
Catch invalid scalar type when parsing tensors #1518
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Summary: Don't fail fatally if the .pte file contains an unknown type enum value. Discovered by lionhead fuzzing. Differential Revision: D52493415
Summary: Flatbuffer array fields can be missing, so we need to check for `nullptr` before calling `size()` on them. Discovered by lionhead fuzzing. Differential Revision: D52493423
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/1518
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 94735dd with merge base a81c2d4 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D52451738 |
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
dbort
added a commit
to dbort/executorch
that referenced
this pull request
Jan 3, 2024
Summary: Fail non-fatally when encountering an unknown/unhandled `ScalarType` in a `.pte` file. As part of this: - Move the "types not supported yet" logic out of `scalar_type_util` and into `tensor_parser`, since that decision is an aspect of the runtime and not a fundamental aspect of `ScalarType`. - Remove the now-duplicate `sizeof_scalar_type` function, which is the same as the exsting `elementSize` function. Before this diff, `sizeof_scalar_type` did the "unsupported" checks that have now moved. - Add an `isValid()` function to let users of `ScalarType` know whether a given enum value is legit. This makes it possible to avoid the fatal error when calling `elementSize` on a bad value. - Add unit tests for the new `isValid()`. Differential Revision: D52451738
This pull request has been merged in 89958d2. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Fail non-fatally when encountering an unknown/unhandled
ScalarType
in a.pte
file. As part of this:scalar_type_util
and intotensor_parser
, since that decision is an aspect of the runtime and not a fundamental aspect ofScalarType
.sizeof_scalar_type
function, which is the same as the exstingelementSize
function. Before this diff,sizeof_scalar_type
did the "unsupported" checks that have now moved.isValid()
function to let users ofScalarType
know whether a given enum value is legit. This makes it possible to avoid the fatal error when callingelementSize
on a bad value.isValid()
.Differential Revision: D52451738