EXTERN char e_blob_required_for_argument_nr[]
INIT(= N_("E1238: Blob required for argument %d"));
EXTERN char e_invalid_value_for_blob_nr[]
- INIT(= N_("E1239: Invalid value for blob: %d"));
+ INIT(= N_("E1239: Invalid value for blob: 0x%lX"));
#endif
EXTERN char e_resulting_text_too_long[]
INIT(= N_("E1240: Resulting text too long"));
if (lp->ll_blob != NULL)
{
- int error = FALSE, val;
+ int error = FALSE;
if (op != NULL && *op != '=')
{
}
else
{
- val = (int)tv_get_number_chk(rettv, &error);
+ varnumber_T val = tv_get_number_chk(rettv, &error);
if (!error)
- blob_set_append(lp->ll_blob, lp->ll_n1, val);
+ {
+ if (val < 0 || val > 255)
+ semsg(_(e_invalid_value_for_blob_nr), val);
+ else
+ blob_set_append(lp->ll_blob, lp->ll_n1, val);
+ }
}
}
else if (op != NULL && *op != '=')
msgstr ""
"Project-Id-Version: Vim\n"
"Report-Msgid-Bugs-To: vim-dev@vim.org\n"
-"POT-Creation-Date: 2025-11-27 21:26+0000\n"
+"POT-Creation-Date: 2025-12-06 10:11+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgstr ""
#, c-format
-msgid "E1239: Invalid value for blob: %d"
+msgid "E1239: Invalid value for blob: 0x%lX"
msgstr ""
msgid "E1240: Resulting text too long"
call v9.CheckSourceLegacyAndVim9Success(lines)
endfunc
+" Test for setting a byte in a blob with invalid value
+func Test_blob_byte_set_invalid_value()
+ let lines =<< trim END
+ VAR b = 0zD0C3E4E18E1B
+ LET b[0] = 229539777187355
+ END
+ call v9.CheckSourceLegacyAndVim9Failure(lines, 'E1239: Invalid value for blob:')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1954,
/**/
1953,
/**/
nr = tv_get_number_chk(tv, &error);
if (error)
return FAIL;
+ if (nr < 0 || nr > 255)
+ {
+ semsg(_(e_invalid_value_for_blob_nr), nr);
+ return FAIL;
+ }
blob_set_append(blob, lidx, nr);
}
else if (dest_type == VAR_CLASS || dest_type == VAR_OBJECT)