Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

arm_semihosting.zig – could @constCast cause a HardFault on read‑only memory?

Abierto
#986 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
zig
Área
embedded-iot

Línea de trabajo

Read core/src/core/arm_semihosting.zig lines 89–96 and trace callers to determine whether the data slice can refer to read-only memory or is guaranteed writable. Check how the function modifies and restores the final byte, then assess whether the current behavior is safe for flash-backed input. Done means the safety assumption is established and, if needed, a safe approach is agreed on.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

core/src/core/arm_semihosting.zig
Lines: 89–96
Hi,I was looking at this piece of code and I have a question about safety.
The function receives data as []const u8, but then uses @constCast to turn it into []u8 and modifies the last byte (first setting it to 0, later restoring the original value).
In embedded systems, the caller might pass a string literal that lives in flash (read‑only memory). If that happens, wouldn’t that write operation trigger a HardFault? Or is the caller expected to always provide a buffer in RAM?
I’m not sure if I’m missing something – maybe the design assumes that the input is always writable? If not, would it be safer to copy the data to a temporary buffer before modifying it?
I’d appreciate your thoughts on this. Thanks!

Lenguaje dominante
Zig
Estrellas
2.3k
Forks
198
Merge medio
1 d 8 h
PR fusionados (30 d)
37

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ZigEmbeddedGroup/microzig

Todos los issues de ZigEmbeddedGroup/microzig

Issues similares

Más issues de Embedded & IoT

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.