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

RANGE_ARRAY_LENGHT and RANGE_ARRAY_OFFSET false negative #595

Closed
yerayrodriguez opened this issue Mar 23, 2018 · 1 comment
Closed

RANGE_ARRAY_LENGHT and RANGE_ARRAY_OFFSET false negative #595

yerayrodriguez opened this issue Mar 23, 2018 · 1 comment
Labels

Comments

@yerayrodriguez
Copy link
Contributor

yerayrodriguez commented Mar 23, 2018

If you invoke read/write operations using lenght = buffer.lenght + 1, RANGE_ARRAY_LENGHT is not detected.

    private static final int BUFFER_LENGTH = 10;
    public void test() {
        File file = new File("temp.txt");
        try (FileReader fr = new FileReader(file)) {
            char[] buffer = new char[BUFFER_LENGTH];
            // False negative: Expected RANGE_ARRAY_LENGHT
            fr.read(buffer, 0, BUFFER_LENGTH + 1);
        } catch (Exception e) {
        }
    }

However, it works correctly with buffer.length + 2.

Same issue with RANGE_ARRAY_OFFSET. Also with some String constructors.

@KengoTODA
Copy link
Member

Closed by #596

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

No branches or pull requests

2 participants