ArrayBuffer.prototype.transfer throws a TypeError instead of a RangeError on a resizable buffer
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 57/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- c, javascript
- Área
- backend
Línea de trabajo
Start by tracing ArrayBuffer.prototype.transfer through ArrayBufferCopyAndDetach to the allocation path for resizable buffers, then compare how that path reports allocation failures with the non-resizable case. Add a regression test for the reproduction in the issue and run the relevant ArrayBuffer tests; done when the resizable-buffer call throws RangeError while existing cases still pass.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Reproduction
new ArrayBuffer(8, { maxByteLength: 16 }).transfer(Number.MAX_SAFE_INTEGER);
Expected
A RangeError is thrown.
V8 (15.6.20):
d8> new ArrayBuffer(8, { maxByteLength: 16 }).transfer(Number.MAX_SAFE_INTEGER);
RangeError: ArrayBuffer.prototype.transfer: Invalid length parameter
Actual (QuickJS-ng)
QuickJS-ng reports the rejected length as a type error:
qjs > new ArrayBuffer(8, { maxByteLength: 16 }).transfer(Number.MAX_SAFE_INTEGER);
TypeError: invalid array buffer length
Spec
ArrayBuffer.prototype.transfer calls ArrayBufferCopyAndDetach with preserve-resizability, which converts newLength with ToIndex and keeps the source's [[ArrayBufferMaxByteLength]] as newMaxByteLength.
2 ** 53 - 1 is a valid index, so it reaches AllocateArrayBuffer. That operation throws a RangeError when byteLength exceeds maxByteLength, and every remaining allocation failure in it is a RangeError as well. No step on this path produces a TypeError.
The error type depends on resizability: new ArrayBuffer(8).transfer(Number.MAX_SAFE_INTEGER) is a RangeError in QuickJS-ng, and so is transfer(2 ** 53), which ToIndex rejects before allocation. Only the resizable buffer takes the TypeError path.
Versions
- QuickJS-ng: 0.17.0
- V8: 15.6.20
- Lenguaje dominante
- C
- Estrellas
- 3.9k
- Forks
- 389
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 21
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
-
Array.prototype.find frees an element twice when interrupted between iterationsPosiblemente ocupada @josefguenther la tomó hace 17 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 13 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 17 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
-
Crash in js_map_finalizer when a WeakMap value is the symbol key of the next entryPosiblemente ocupada @wleeaf la tomó hoy. Abierto
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
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
quickjs-ng/quickjs#1833 ·
Los mantenedores suelen responder en 2 días
Todos los issues de quickjs-ng/quickjs
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 90/100
Lakr233/vphone-cli#743 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
libsdl-org/SDL#16584 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
FriendsofECCE/ECCE#519 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
containers/crun#2415 ·
Los mantenedores suelen responder en 1 día