Page MenuHomeWildfire Games

Fix text input max_length attribute.
ClosedPublic

Authored by Stan on Oct 15 2019, 3:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 6, 7:05 PM
Unknown Object (File)
Fri, Sep 6, 3:28 PM
Unknown Object (File)
Wed, Sep 4, 11:18 AM
Unknown Object (File)
Wed, Sep 4, 11:18 AM
Unknown Object (File)
Wed, Sep 4, 11:18 AM
Unknown Object (File)
Wed, Sep 4, 11:18 AM
Unknown Object (File)
Wed, Sep 4, 11:18 AM
Unknown Object (File)
Sat, Aug 24, 12:06 PM
Subscribers
Restricted Owners Package

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23927: Fix text input max_length attribute. fixes rP15785
Summary

See #5266 caused by rP15785

Test Plan

Check any text fuzzing you now to make sure one cannot enter more than X characters in the fields with a max_length attribute.

Event Timeline

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/974/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/459/display/redirect

Original patch was made by Amplikon, but has been mostly rewritten.

To answer smiley's comments,

In #5266, @smiley wrote:

Use static_cast<int> instead of (int).

Done.

In #5266, @smiley wrote:

Unsigned integer probably.

int is used everywhere else except in one place where it uses long for some reason.

In #5266, @smiley wrote:

Sure it should not be a break;? (Same thing is in L308, Plus, from a quick skim, break; makes more sense to me. Could be wrong of course.)

Yep, because in this case if the function expect a return type, which was not easily visible without context.

Stan removed a subscriber: lyv.

Since apparently I had commented on this before, I have a feeling this would not quite work the way it should in certain cases.

Then again, its just a feeling. Consider that before wasting hours on potentially nothing.

In D2377#99209, @smiley wrote:

Since apparently I had commented on this before, I have a feeling this would not quite work the way it should in certain cases.

Then again, its just a feeling. Consider that before wasting hours on potentially nothing.

Thanks for the fair warning, and the time you took to express it :)

Stan planned changes to this revision.Mar 15 2020, 5:18 PM

This should be updated.

Rebase.
Fix logic.
Add support for max length with paste
Remove casts.

The default case l324 seems useless but I'm not sure. I have not been able to enter it

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2789/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1157/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2829/display/redirect

Thanks for the fair warning, and the time you took to express it :)

Actually, no. That was a snarky at best, counter productive at worst warning.

Regardless, your refactor fixed that bug.

wraitii requested changes to this revision.Aug 1 2020, 5:18 PM
wraitii added a subscriber: wraitii.

You're missing the case where the user-autocompletes a pseudo, or any JS modifying "caption" in fact. You probably need to add a final check in UpdateText() or in HandleMessage.

Otherwise seems to work.

See D2629 for a bug where text-too-long crashes.

This revision now requires changes to proceed.Aug 1 2020, 5:18 PM

Broken attempt @wraitii can you help me

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2832/display/redirect

Don't crop non maxlength inputs

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2842/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2843/display/redirect

Seems to work fine now.

This revision is now accepted and ready to land.Aug 3 2020, 1:46 PM
This revision was automatically updated to reflect the committed changes.
Owners added a subscriber: Restricted Owners Package.Aug 3 2020, 2:39 PM