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

fixes memory corruption with multi-dimensional arrays #153

Merged
merged 1 commit into from
May 1, 2017
Merged

fixes memory corruption with multi-dimensional arrays #153

merged 1 commit into from
May 1, 2017

Conversation

YashasSamaga
Copy link
Member

static const Test[2][][2] = { { { 9, 8 } }, { { 6, 7 } } };

The above code causes a memory corruption as the compiler does not
correctly calculate the size of the array.

This commit adds code to fix it.

static const Test[2][][2] = { { { 9, 8 } },  { { 6, 7 } } };

The above code causes a memory corruption as the compiler does not
correctly calculate the size of the array.

This commit adds code to fix it.
@YashasSamaga
Copy link
Member Author

YashasSamaga commented Feb 13, 2017

I was thinking of removing that code from initials and moving it to calc_arraysize instead but this would execute some extra useless code every time (it calls itself? so it does the same checks over and over again). calc_arraysize is supposed to return 0 when it is not able to calculate the full size of the array but it doesn't when the dimensions are more than 2.

#84

@YashasSamaga YashasSamaga mentioned this pull request Feb 13, 2017
@Zeex Zeex merged commit 17d392b into pawn-lang:master May 1, 2017
@Zeex
Copy link
Member

Zeex commented May 1, 2017

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants