MarlinFirmware / MarlinDocumentation

Marlin Firmware Documentation Project
https://marlinfw.org
GNU General Public License v3.0
366 stars 764 forks source link

update hex regular expression in RGB565 converter tool #518

Closed ellensp closed 11 months ago

ellensp commented 11 months ago

I missed a bug in processing pasted rle16 encoded data

the code if (s.match(/0x[0-9a-f]+/i)) { // Hex is meant to match hexadecimal encoded strings only eg 0x12FE

It doesn't trigger on "marlin_logo_195x59x16_rle16" which is what I did my testing on.

But it does match on "marlin_logo_240x250x16_rle16" Causing the image to be incorrectly decoded

Updated the RE to /0x[0-9a-f]+(?![0-9x_])/i to exclude the false positive.