/* Determine number of screen columns needed for a size-bounded wide string.
- Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2011-2013 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 1999.
This program is free software: you can redistribute it and/or modify
int width = wcwidth (c);
if (width < 0)
goto found_nonprinting;
+ if (width > INT_MAX - count)
+ goto overflow;
count += width;
}
}
found_nonprinting:
return -1;
+
+ overflow:
+ return INT_MAX;
}