-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
When using a StructList the size is not checked when adding new entries.
For example:
StructList.Builder<PhoneNumber.Builder> personPhones
= person.initPhones(0);
personPhones.get(0).setNumber("08031/12345");
personPhones.get(0).setType(PhoneType.WORK);
personPhones.get(1).setNumber("0160/9876543");
personPhones.get(1).setType(PhoneType.MOBILE);
Will give no error or exception but the data is not written.
Or worste if you have a bit of space:
StructList.Builder<PhoneNumber.Builder> personPhones
= person.initPhones(1);
personPhones.get(0).setNumber("08031/12345");
personPhones.get(0).setType(PhoneType.WORK);
personPhones.get(1).setNumber("0160/9876543");
personPhones.get(1).setType(PhoneType.MOBILE);
You get the following:
work phone: 031/12
So your data is destroyed.
In both cases I would expect an exception.
Metadata
Metadata
Assignees
Labels
No labels