* lib/szprintf.c (szprintf): Ensure lenbuf is at most INT_MAX.
* lib/vszprintf.c (vszprintf): Likewise.
* lib/unistdio/u-vsprintf.h (VSPRINTF): Ensure lenbuf is at most
INT_MAX / sizeof (DCHAR_T).
2026-07-25 Bruno Haible <bruno@clisp.org>
+ [v]szprintf: Port to Fil-C.
+ * lib/szprintf.c (szprintf): Ensure lenbuf is at most INT_MAX.
+ * lib/vszprintf.c (vszprintf): Likewise.
+ * lib/unistdio/u-vsprintf.h (VSPRINTF): Ensure lenbuf is at most
+ INT_MAX / sizeof (DCHAR_T).
+
fpucw: Avoid runtime error with Fil-C.
* lib/fpucw.h: Use no-op definitions with Fil-C.
#include <stdio.h>
#include <errno.h>
+#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
size_t lenbuf = SIZE_MAX;
if (lenbuf >= ~ (uintptr_t) str)
lenbuf = ~ (uintptr_t) str;
+#if defined __FILC__
+ if (lenbuf > INT_MAX)
+ lenbuf = INT_MAX;
+#endif
char *output = vasnprintf (str, &lenbuf, format, args);
size_t len = lenbuf;
size_t length = (SIZE_MAX < INT_MAX ? SIZE_MAX : INT_MAX);
if (length > (~ (uintptr_t) buf) / sizeof (DCHAR_T))
length = (~ (uintptr_t) buf) / sizeof (DCHAR_T);
+#if defined __FILC__
+ if (length > INT_MAX / sizeof (DCHAR_T))
+ length = INT_MAX / sizeof (DCHAR_T);
+#endif
DCHAR_T *result = VASNPRINTF (buf, &length, format, args);
if (result == NULL)
#include <stdio.h>
#include <errno.h>
+#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
size_t lenbuf = SIZE_MAX;
if (lenbuf >= ~ (uintptr_t) str)
lenbuf = ~ (uintptr_t) str;
+#if defined __FILC__
+ if (lenbuf > INT_MAX)
+ lenbuf = INT_MAX;
+#endif
char *output = vasnprintf (str, &lenbuf, format, args);
size_t len = lenbuf;