Investigate integer overflow and page size in `get_invoice_range`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 65/100
Línea de trabajo
Start with get_invoice_range in contracts/invoice/src/lib.rs, where start_idx + len_val is computed on usize values converted from u32. Add tests in contracts/invoice/src/test.rs for len = 0, start past the length, start = u32::MAX, and a very large len, then switch to saturating arithmetic and cap the page size. Done when no input traps, the cap is documented in contracts/invoice/README.md, and fmt, clippy and tests pass. The 32-bit wasm behaviour still needs confirming on that target, which the host tests cannot show.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Difficulty: Intermediate
Problem
get_invoice_range computes (start_idx + len_val).min(...) on usize values converted from u32. On the 32-bit wasm target usize is 32 bits, and the release profile enables overflow-checks, so a large start plus len could trap instead of returning an empty page. Host tests run on a 64-bit target and cannot show this. There is also no maximum page size.
Why it matters
A public read function should never trap on valid-looking input, and unbounded pages can exceed resource limits.
Scope of work
Confirm the behaviour on the wasm target, switch to saturating arithmetic, add a documented maximum page size, and add tests for len = 0, start greater than the length, start = u32::MAX, and a very large len.
Expected outcome
get_invoice_range handles all inputs safely, and the behaviour is covered by tests.
Acceptance criteria
- No input traps; extreme inputs return an empty or capped page.
- A page-size cap is documented in the contract README.
- New tests pass;
cargo fmt --check, clippy and tests pass.
Relevant files
contracts/invoice/src/lib.rs,contracts/invoice/src/test.rs,contracts/invoice/README.md
Dependencies
Related to #55 and #27 (same file). No ABI change is required.
Maintainer discussion needed?
No (internal behaviour only).
- Lenguaje dominante
- TypeScript
- Estrellas
- 0
- Forks
- 4
- Merge medio
- 54 min
- PR fusionados (30 d)
- 6
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin 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 Yormee-103/PayLoop
-
Add a CHANGELOG and release-notes conventionPosiblemente ocupada @Sharon-dev-create la tomó hoy. Abiertodifficulty: beginner documentation dx help wanted Stellar Wave
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Yormee-103/PayLoop#169 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Glossary of Stellar and PayLoop terms, linked from the Help pagePosiblemente ocupada @Yemmy88 la tomó hoy. Abiertodifficulty: beginner documentation good first issue help wanted Stellar Wave
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Yormee-103/PayLoop#168 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
difficulty: beginner dx good first issue help wanted web
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Yormee-103/PayLoop#158 ·
Los mantenedores suelen responder en 1 día
-
difficulty: beginner documentation good first issue help wanted security
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Yormee-103/PayLoop#145 ·
Los mantenedores suelen responder en 1 día
-
a11y difficulty: beginner good first issue help wanted web
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Yormee-103/PayLoop#144 ·
Los mantenedores suelen responder en 1 día
Todos los issues de Yormee-103/PayLoop
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
agent-canvas bug oh-gpt-fleet priority:medium ready-for-dev UI/UX
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
good first issue javascript test
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
writerslogic/scrivener-mcp#272 ·
Los mantenedores suelen responder en 1 día
-
bug triaged tui ux wontfix
Dificultad 2/5 Medio día Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día