Skip to content

Source: Avoid out-of-range inputs to std::isspace()

Brad King requested to merge brad.king/cmake:isspace into master

isspace takes int but documents that the value must be representable by unsigned char, or be EOF. Use a wrapper to cast to unsigned char to avoid sign extension while converting to int. This generalizes the fix from !9132 (merged) to other isspace call sites.

This was detected by assertions in the MSVC standard library while processing UTF-8 text.

Issue: #25561 (closed)

Merge request reports