[Fix] Fix potential array overrun risk #872
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.
Motivation
I would like to use the OrientedRCNN model, but it seems that the model library in version 1.x is not yet fully developed. Therefore, I choose to continue using the main version. In the main version, when testing with the DOTA dataset, I encounter the following error due to array out-of-bounds:
Modification
To address this error, I examined the values of
x_y
on a small dataset and found that they were all empty lists.x_y
is treated as an offset in the program, and to avoid array out-of-bounds, I added a conditional check. Whenx_y
is empty, I set it to the default value of (0, 0).I tested the modified program on both small and large datasets, and the error was resolved. The test yielded reasonable results that aligned with expectations.
The modifications are as follows:
BC-breaking
The current modification is applicable to the main version and the current documentation. I noticed that the 1.x version has made changes to the overall architecture. Until the release of the 1.x version, this modification is worthwhile.
Use cases
This PR does not introduce any new features. Therefore, no specific use cases or updates to the documentation are necessary.
Checklist
Please let me know if you need any further assistance or if there is anything else I can help you with.