{"record":{"id":"04b083fc1bfad811","repo":"Yalantis/uCrop","slug":"invalid-sequence-of-filling-values-s","errorCode":null,"errorMessage":"Invalid sequence of filling values '%s'.","messagePattern":"Invalid sequence of filling values '(.+?)'\\.","errorType":"exception","errorClass":"CImgArgumentException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":35207,"sourceCode":"      cimg::exception_mode(excmode);\n      cimg_abort_test;\n      return *this;\n    }\n\n    //! Fill sequentially pixel values according to a given expression \\newinstance.\n    CImg<T> get_fill(const char *const expression, const bool repeat_values, const bool allow_formula=true,\n                     CImgList<T> *const list_images=0) const {\n      return (+*this)._fill(expression,repeat_values,allow_formula?3:1,list_images,\"fill\",this,0);\n    }\n\n    //! Fill sequentially pixel values according to a value sequence, given as a string.\n    /**\n       \\param values C-string describing a sequence of values.\n       \\param repeat_values Tells if this sequence must be repeated when filling.\n    **/\n    CImg<T>& fill_from_values(const char *const values, const bool repeat_values) {\n      if (_fill_from_values(values,repeat_values))\n        throw CImgArgumentException(_cimg_instance\n                                    \"Invalid sequence of filling values '%s'.\",\n                                    cimg_instance,values);\n      return *this;\n    }\n\n    //! Fill sequentially pixel values according to a value sequence, given as a string \\newinstance.\n    CImg<T> get_fill_from_values(const char *const values, const bool repeat_values) const {\n      return (+*this).fill_from_values(values,repeat_values);\n    }\n\n    // Fill image according to a value sequence, given as a string.\n    // Return 'true' if an error occured, 'false' otherwise.\n    bool _fill_from_values(const char *const values, const bool repeat_values) {\n      CImg<charT> item(256);\n      const char *nvalues = values;\n      const ulongT siz = size();\n      T *ptrd = _data;\n      ulongT nb = 0;","sourceCodeStart":35189,"sourceCodeEnd":35225,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L35189-L35225","documentation":"CImg's fill_from_values() parses a C-string of space/comma-separated pixel values and fills the image with them. It first runs the internal _fill_from_values() parser; if that reports failure (the string is empty, malformed, or contains unparseable tokens) it throws this CImgArgumentException. The library throws it because continuing would leave the fill partially applied or silently wrong.","triggerScenarios":"Calling CImg<T>::fill_from_values(const char* values, ...) with a null pointer, an empty string, or a string containing non-numeric tokens or a wrong number of values for the requested fill (e.g. \"1 2 abc\" or a truncated sequence when repeat_values is false).","commonSituations":"Programmatically constructing a fill string (e.g. with snprintf/sprintf) so it ends up empty or truncated; locale issues where decimal commas instead of dots break number parsing; passing a std::string via .c_str() after it went out of scope or was never populated; hand-edited value lists with typos.","solutions":["Print/log the values string right before the call and verify every token parses as a number in the current locale (use '.' as decimal separator).","Check the string is non-null and non-empty before calling; guard against failed sprintf/snprintf which can leave the buffer empty.","Count the supplied values against what the fill expects (with repeat_values=false the sequence must match the pixel count or a multiple pattern CImg accepts).","If building from std::string, ensure it lives until after the fill_from_values call and pass .c_str() of a live object."],"exampleFix":"// before\nchar buf[16];\nsnprintf(buf, sizeof buf, \"%f %f\", r); // truncated, missing second value\nimg.fill_from_values(buf, false); // throws\n// after\nchar buf[64];\nint n = snprintf(buf, sizeof buf, \"%f %f\", r, g);\nif (n > 0 && buf[0] != '\\0') img.fill_from_values(buf, false);","handlingStrategy":"validation","validationCode":"bool validFillValues(const char* values) {\n  if (!values || !*values) return false;\n  for (const char* p = values; *p; ++p)\n    if (!(isdigit((unsigned char)*p) || *p=='.' || *p=='-' || *p=='+' || *p=='e' || *p=='E' || isspace((unsigned char)*p) || *p==','))\n      return false;\n  return true;\n}\nif (validFillValues(vals)) img.fill_from_values(vals, repeat);","typeGuard":null,"tryCatchPattern":"try {\n  img.fill_from_values(values, repeat_values);\n} catch (const CImgArgumentException& e) {\n  std::fprintf(stderr, \"fill_from_values rejected input '%s': %s\\n\", values, e.what());\n}","preventionTips":["Log the exact values string at the call site before invoking fill_from_values.","Use '.' decimal separators; be aware of locale-dependent formatting from snprintf.","Guard snprintf results: check return value and that the buffer is non-empty.","Keep the source std::string alive for the duration of the call."],"tags":["cimg","argument-validation","image-processing","jni"],"backgroundTag":"invalid-argument-format","analyzedSha":"f788b534b48c144edf786c8cddbf0e029e637804","analyzedAt":"2026-09-08T08:36:04.887Z","contentChangedAt":"2026-09-08T08:36:04.887Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}