Incorrect size calculation in length validator

Bug #1797136 reported by Oleg Ovcharuk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
In Progress
High
Oleg Ovcharuk

Bug Description

In function validate_long_type_length there is a value size calculation.
 size_kb = int(sys.getsizeof(str(value)) / 1024)
There should not be integer division, but float.
For example, if the size limit is 1KB and the sys.getsizeof(str(value)) is e.g. 1600B, calculated size will be 1, and the size limit check will be passed. This is wrong behavior.

Changed in mistral:
assignee: nobody → Oleg Ovcharuk (vgvoleg)
importance: Undecided → High
status: New → Confirmed
milestone: none → stein-1
Changed in mistral:
status: Confirmed → In Progress
Dougal Matthews (d0ugal)
Changed in mistral:
milestone: stein-1 → stein-2
Changed in mistral:
milestone: stein-2 → stein-3
Changed in mistral:
milestone: stein-3 → train-1
Changed in mistral:
milestone: train-1 → ussuri-1
Changed in mistral:
milestone: ussuri-1 → ussuri-2
Changed in mistral:
milestone: ussuri-2 → ussuri-3
Changed in mistral:
milestone: ussuri-3 → victoria-1
Changed in mistral:
milestone: victoria-1 → wallaby-1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.