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

JvMemoryData: Check if Offset overflows before adding to it. #114

Conversation

Projects
None yet
2 participants
@MHumm
Copy link
Contributor

commented May 1, 2019

Improved version of #92
Includes raising an exception and is hopefully good enough now.
Fix for Mantis issue 6570
http://issuetracker.delphi-jedi.org/view.php?id=6570

if Offset + FieldLen + 1 <= high(Offset) then
Inc(Offset, FieldLen + 1)
else
raise EIntOverflow.CreateResFmt(RsEFieldOffsetOverflow, [I]);

This comment has been minimized.

Copy link
@obones

obones May 1, 2019

Member

To me, EIntOverflow is when an Integer value goes over MaxInt and here, I believe it's more an "out of range" issue, so ERangeError seems better to me

This comment has been minimized.

Copy link
@MHumm

MHumm May 1, 2019

Author Contributor

Ok, added another commit where I changed the exception thrown. I hope it's good for the merge now ;-) When implementing the first variant I really had both exception classes in mind...

@obones obones merged commit a48df1a into project-jedi:master May 1, 2019

@MHumm MHumm deleted the MHumm:Mantis6570_Overflow_in_JvMemoryData_with_exception branch May 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.