JS_ThrowStackOverflow may overflow stack itself
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Read build_backtrace() in quickjs.c around the stack-heavy JSCallSiteData allocation and the char buf[256] local mentioned in the issue. Trace how JS_ThrowStackOverflow() reaches backtrace construction, then assess the proposed approaches and their stack requirements. Done means throwing at the configured stack limit cannot itself overflow the physical stack.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hello,
QuickJS supports stack limiting with JS_SetMaxStackSize(), and many operations check remaining stack size before alloca() or calling functions. These checks call JS_ThrowStackOverflow(), which should throw corresponding exception. Obviously this exception has a stacktrace.
But the problem is that build_backtrace() function consumes huge amount of stack itself. For example, just this line implies x64 JSCallSiteData structs, each of them is x3 JSValue (+ 9 bytes + align), and each JSValue may be up to 16 bytes on x64 machine (depending on flags). This gives us 64 * aligned(3 * 16 + 9) = 3840 bytes. The full call chain performed to fill backtrace also includes other stack-heavy things, like char buf[256]. Since the exception itself was thrown because we've already reached stack limit, there is a risk of "physically" overflowing the stack if the limit was configured somewhat near the real stack size.
For now the only workaround is to set limit way lower than real stack size, but the needed spare space seems to be unpredictable.
Proposed solutions:
- Calculate and enforce maximum stack consumption for
JS_ThrowStackOverflow()and specify it in documentation; - Make
build_backtrace()and other corresponding functions less stack-heavy, moving every possible local value on (pre-allocated?) heap buffer; - Add some stack checks to throwing-related functions and fallback to skipping backtrace if building stacktrace is impossible.
- Lenguaje dominante
- C
- Estrellas
- 3.9k
- Forks
- 389
- Merge medio
- 4 d 1 h
- PR fusionados (30 d)
- 24
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
- 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 quickjs-ng/quickjs
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
quickjs-ng/quickjs#1836 ·
Los mantenedores suelen responder en 2 días
-
Array.prototype.find frees an element twice when interrupted between iterationsPosiblemente ocupada @josefguenther la tomó hace 14 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
quickjs-ng/quickjs#1792 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Object.prototype.propertyIsEnumerable converts `this` before the property keyPosiblemente ocupada @SomSamantray la tomó hace 10 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
quickjs-ng/quickjs#1772 ·
Los mantenedores suelen responder en 2 días
-
Deserialization corrupts data or returns `undefined` when a RegExp precedes a shared object referencePosiblemente ocupada @Sree24-ui la tomó hace 14 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
quickjs-ng/quickjs#1771 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
quickjs-ng/quickjs#1835 · 1 reacción ·
Los mantenedores suelen responder en 2 días
Todos los issues de quickjs-ng/quickjs
Issues similares
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
v9.6.0: CMake incorrectly enforces presence of libevdevPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
IoTSDK
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Azure/azure-iot-sdk-c#2776 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
-
[Bug] Unhandled ValueError terminates watchdog thread when GISRC value contains multiple colonsAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día