Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Incorrect condition checking in UserProcess.java #4

Open
ags3927 opened this issue Nov 13, 2020 · 0 comments
Open

Incorrect condition checking in UserProcess.java #4

ags3927 opened this issue Nov 13, 2020 · 0 comments

Comments

@ags3927
Copy link

ags3927 commented Nov 13, 2020

In Line 222 (see this) of UserProcess.java, the if condition checks i > pageTable.length. This is problematic because all of these things are zero-indexed.
i refers to the exact page number that directly maps to the pageTable array indices. So the largest valid value of i would be pageTable.length - 1, not pageTable.length. The if condition allows i to reach pageTable.length and that could potentially result in an error.

Please correct me if I am incorrect in my understanding of the code.

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

No branches or pull requests

1 participant