UB: (int) cast of a user double outside int range in dispatch / vm_index_is_int / flat_index_at
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
Línea de trabajo
Empieza por los cuatro sitios indicados: builtin_dispatch en src/builtins.c alrededor de la línea 5946, vm_index_is_int en src/vm.c, la rama de lista de flat_index_at en src/builtins_tensor.c y finite_num_to_byte. Reproduce con el fragmento de despacho del issue bajo make asan para ver el informe de UBSan float-cast-overflow. Está terminado cuando cada sitio comprueba el rango del double antes de hacer el cast (NaN da falso), el barrido grep -n '(int)' src/*.c está clasificado y el reproductor imprime el error value sin ninguna línea runtime error:.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Found while building #1746 Phase 1. Several sites convert a user double to int with a bare (int) cast before any range check. For |x| >= 2^31 (today: up to ±1e308; under an IEEE build also inf/NaN) that is undefined behaviour, and UBSan's float-cast-overflow (on in every ASan variant) reports it.
Repro (any asan build):
define g(x) as:
return x
d is dispatch
print of (d of [[g], 1e308, 5])
-> src/builtins.c:5946:20: runtime error: 1e+308 is outside the range of representable values of type 'int' (then the intended dispatch key must be an integer raise).
Sites: builtin_dispatch (builtins.c, (int)eigs_num_arg(key_v, ...)), vm_index_is_int (vm.c), flat_index_at list arm (builtins_tensor.c), finite_num_to_byte ((int)fmod(x,256) with a NaN). The #1746 experiment guards only vm_index_is_int, only under -DEIGS_IEEE.
Done when
- Each listed site range-checks (
!(d >= INT_MIN && d <= INT_MAX)style, NaN-false) before the cast, and the sweepgrep -n '(int)' src/*.cover user-double conversions is classified. - The repro above is clean under
make asan(noruntime error:), and still raisesvalue.
- Lenguaje dominante
- C
- Estrellas
- 3
- Forks
- 7
- Merge medio
- 8 h 41 min
- PR fusionados (30 d)
- 254
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de InauguralSystems/EigenScript
-
eigenscript.h declares 8 observer functions that no longer existPosiblemente ocupada @facelessdevhack la tomó hace 2 días. Abiertoarea:observer enhancement found-by:cold-read good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
InauguralSystems/EigenScript#1781 ·
Los mantenedores suelen responder en 1 día
-
Amalgamation compiles with warnings at -O0 (-Wreturn-type) and -O1 (-Wmaybe-uninitialized)Posiblemente ocupada @facelessdevhack la tomó hace 2 días. Abiertoarea:embed bug found-by:code-review
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
InauguralSystems/EigenScript#1775 ·
Los mantenedores suelen responder en 1 día
-
scan_int_tokens line/col fields are untestedPosiblemente ocupada @facelessdevhack la tomó hace 2 días. Abiertoarea:stdlib found-by:critic kind:gate-defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
InauguralSystems/EigenScript#1693 ·
Los mantenedores suelen responder en 1 día
-
area:gfx bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
InauguralSystems/EigenScript#1684 ·
Los mantenedores suelen responder en 1 día
-
area:stdlib bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
InauguralSystems/EigenScript#1679 ·
Los mantenedores suelen responder en 1 día
Todos los issues de InauguralSystems/EigenScript
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
libsdl-org/SDL#16539 ·
Los mantenedores suelen responder en 1 día
-
git-workflow task-4
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
dosemu2/dosemu2#3178 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día