Skip to content

Conversation

@mwshinn
Copy link

@mwshinn mwshinn commented Jan 4, 2022

The current code segfaults for large bases because it reads past the end of the _PERM array. There are a few possible fixes with advantages and disadvantages. This fix accepts all bases, but it cycles with a period of 256. An alternative method is to throw an error for bases larger than 256.

ii = ((ii + base) & 255);
jj = ((jj + base) & 255);
kk = ((kk + base) & 255);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand you're capping the result to 255. This can be misleading to the user since it's a hidden operation : the user could expect different results with larger values for base and not get them.

I'd recommend throwing an error or at least a warning.

@mwshinn
Copy link
Author

mwshinn commented Feb 20, 2022

I think you're right, this commit throws errors for bases that have the potential to be non-unique.

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.

2 participants