Opened 3 years ago

Closed 3 years ago

#18982 closed Bug (fixed)

DateField.clean raises TypeError when passed NUL bytes. Should be ValidationError.

Reported by: gwahl@… Owned by: aaugustin
Component: Forms Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When a DateField (or any BaseTemporalField) tries to clean a value with a NUL byte (like 'a\x00b'), the call to strptime() raises an uncaught TypeError. It should raise a ValidationError instead, because 'a\x00b' is not a valid date.

I have a patch for this, pull request to come.

Change History (3)

comment:1 Changed 3 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 3 years ago by aaugustin

  • Owner changed from nobody to aaugustin

comment:3 Changed 3 years ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 3174b5f2f5bb0b0a6b775a1a50464b6bf2a4b067:

Fixed #18982 - Caught TypeError in DateField.clean

Thanks gwahl at fusionbox com.

Note: See TracTickets for help on using tickets.
Back to Top