Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(olympics): check bounds out of range for limit in top-athletes-in-sport test #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

a1k0u
Copy link

@a1k0u a1k0u commented Apr 14, 2024

В тесте top-countries-in-year есть примеры, когда limit в реквесте превышает общее количество найденых результатов в json-файле. Из-за неправильной обработки можно получить slice bounds out of range. Это не проверяется в хендлере для top-athletes-in-sport. Этот PR направлен на добавление такого примера.

Вот однострочник :trollface:, который показывает, что такого примера в top-athletes-in-sport нет:

(cd olympics/testdata/tests/top-athletes-in-sport; for i in $(ls); do echo "limit_in=$(cat "$i/in.json" | jq ".limit") response_count=$(cat "$i/out.json" | jq "length")"; done)

@a1k0u
Copy link
Author

a1k0u commented Apr 14, 2024

@slon, в ревьюверы не могу добавить, поэтому тегну 🙏

@@ -1 +1 @@
{"sport": "Biathlon", "limit": 10}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А out.json тут не должен поменяться?

Copy link
Contributor

@WinnerOK WinnerOK Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В биатлоне там 69 спортсменов - длинный тест получится. Но если хотите - вот все биатлонисты
https://hatebin.com/jrjrumjnhh
one liner: https://hatebin.com/rasajqvpdb

Можно Skeleton, limit 123 (в скелетоне всего 17 спортсменов)
https://hatebin.com/lqeehqbpvp
one liner: https://hatebin.com/iogkhpklnr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants