thomasp85 / farver

High Performance Colourspace Manipulation in R
https://farver.data-imaginist.com
Other
125 stars 14 forks source link

farver segfault #31

Closed pmur002 closed 2 years ago

pmur002 commented 2 years ago

farver::encode_colour() needs to check for "empty" inputs (e.g., zero-row matrix or zero-length alpha) because C level encode_c() accesses, for example, REAL(alpha)[0] without checking.

Example that segfaults on one of my OS-R-version combinations (on other combinations I think it is just getting lucky):

farver::encode_colour(matrix(numeric(0), ncol=3), numeric(0))

Same comment applies to farver::decode_colour() presumably.