-
Notifications
You must be signed in to change notification settings - Fork 161
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
Some more tests for the kernel #2502
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2502 +/- ##
==========================================
+ Coverage 74.25% 74.29% +0.03%
==========================================
Files 482 482
Lines 245204 245181 -23
==========================================
+ Hits 182082 182162 +80
+ Misses 63122 63019 -103
|
*/ | ||
Obj FuncEmptyString( Obj self, Obj len ) | ||
{ | ||
Obj new; | ||
while ( ! IS_INTOBJ(len) ) { | ||
while ( ! IS_NONNEG_INTOBJ(len) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking this is a bug fix preventing OOB access. Perhaps should be mentioned in the commit message. Not sure if we care about it for release notes - perhaps a generic entry "improved input validation for several kernel functions"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some generic comment like that would be useful.
src/stringobj.c
Outdated
"you can replace <trans> via 'return <trans>;'" ); | ||
} | ||
|
||
if ( GET_LEN_STRING( trans ) < 256 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, this must be changed to ˋelse ifˋ (user might have returned e.g. a boolean)
tst/testinstall/kernel/stringobj.tst
Outdated
2 | ||
gap> POSITION_SUBSTRING("abc","b",3); | ||
fail | ||
gap> POSITION_SUBSTRING("abc","x",3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be 0 not 3
e1dedcc
to
da22cf8
Compare
In particular, replace recursion by loops where possible
@ChrisJefferson FYI I dropped the tabs->spaces changes. |
*/ | ||
Obj FuncEmptyString( Obj self, Obj len ) | ||
{ | ||
Obj new; | ||
while ( ! IS_INTOBJ(len) ) { | ||
while ( ! IS_NONNEG_INTOBJ(len) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some generic comment like that would be useful.
No description provided.