# Extended 5.10 — sqUnixCharConv: toupper(signed char) UB for non-ASCII + unchecked malloc

Bug ref      : pharo.md §5.10
Severity     : MEDIUM (UB on encoding names with non-ASCII; NULL deref on OOM)
File         : extracted/vm/src/unix/sqUnixCharConv.c
Lines (HEAD) : 199-211 (`setNEncoding`)

## Problem

```c
char *name = malloc((size_t)((n + 1) * sizeof(char)));
...
for (i = 0; i < n; ++i)
    name[i] = toupper(rawName[i]);
```

Two issues:
  1. `malloc` not checked.
  2. `toupper(int)` is undefined for arguments outside
     `unsigned char` range; passing a signed char with the
     high bit set is UB on many libc implementations.

## Fix

```diff
diff --git a/extracted/vm/src/unix/sqUnixCharConv.c b/extracted/vm/src/unix/sqUnixCharConv.c
index 0b1aa785f..45dff6b54 100644
--- a/extracted/vm/src/unix/sqUnixCharConv.c
+++ b/extracted/vm/src/unix/sqUnixCharConv.c
@@ -206,8 +206,12 @@ void setNEncoding(void **encoding, char *rawName, int n)
       {"MAC-ROMAN", macEncoding},
     };
 
+  if (!name) {
+    logError("setNEncoding: out of memory");
+    return;
+  }
   for (i= 0;  i < n;  ++i)
-    name[i]= toupper(rawName[i]);
+    name[i]= (char)toupper((unsigned char)rawName[i]);
   name[n]= '\0';
   if ((*encoding) && (*encoding != localeEncoding))
     freeEncoding(*encoding);
```

## Test plan

- Set an encoding name containing high-bit characters (e.g.
  `\xc3\xa9` for é). Before: UB depending on libc. After: clean
  per-byte uppercase.
- OOM: function logs and returns rather than dereferencing NULL.

## Risk notes

- Cast to `unsigned char` first is the canonical safe pattern for
  ctype.h functions.
