-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-40176: field_charset()->charpos(blob..) called with NULL #5304
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
base: 10.11
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9035,10 +9035,13 @@ uint Field_blob::get_key_image_itRAW(const uchar *ptr_arg, uchar *buff, | |
| { | ||
| size_t blob_length= get_length(ptr_arg); | ||
| const uchar *blob= get_ptr(ptr_arg); | ||
| size_t local_char_length= length / mbmaxlen(); | ||
| local_char_length= field_charset()->charpos(blob, blob + blob_length, | ||
| local_char_length); | ||
| set_if_smaller(blob_length, local_char_length); | ||
| if (blob) | ||
| { | ||
| size_t local_char_length= length / mbmaxlen(); | ||
| local_char_length= field_charset()->charpos(blob, blob + blob_length, | ||
| local_char_length); | ||
| set_if_smaller(blob_length, local_char_length); | ||
| } | ||
|
Comment on lines
+9038
to
+9044
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of checking if (blob_length > 0)
{
size_t local_char_length= length / mbmaxlen();
local_char_length= field_charset()->charpos(blob, blob + blob_length,
local_char_length);
set_if_smaller(blob_length, local_char_length);
}
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bit clearer. Could |
||
|
|
||
| if (length > blob_length) | ||
| { | ||
|
|
||
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 believe this is not the only place where we call
charposfunction and if we were to do this kind of checks, we should be doing it in all other places too.Fixing the root cause, i.e
my_charpos_*set of functions to handle null seems like correct fix to me. thoughts @grooverdan ?