thomasp85/farver

farver segfault

pmur002 opened this issue · 0 comments

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.