Re: Are there use cases for storing null bytes in CharField/TextField?

2017-06-02 Thread Tim Graham
I found a PostgreSQL bug report requesting removal of the restriction. Here's the final reply: Franklin Schmidt wrote: > I agree that storing 0x00 in a UTF8 string is weird, but I am > converting a huge database to postgres, and in a huge database, weird > things happen. Using bytea for a text

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-31 Thread Jon Dufresne
On Mon, May 15, 2017 at 10:30 AM, Tim Chase wrote: > On 2017-05-15 08:54, Tim Graham wrote: > > Does anyone know of a use case for using null bytes in > > CharField/TextField? > > Is this not what BinaryField is for? It would seem to me that > attempting to store

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-19 Thread Tim Graham
If CharField/TextField have a form validation error if null bytes are in the input, are users going to be able to understand that error and fix it? I'm not sure if it's a probable case, but I'm thinking of a non-technical user who copy/pastes some text that includes a null byte. Perhaps a "

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-16 Thread Jani Tiainen
Hi, I would guess that one could use null byte to denote "empty field" in Oracle for example. (I recall seeing such a convention in one of our non-django apps). And that's to overcome limitation that Oracle doesn't have real concept of empty string so we stored single null byte to mark that.

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-15 Thread Claude Paroz
I also think that this should be handled at serialization level (form fields and (de)serialization framework). Claude -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-15 Thread Tim Chase
On 2017-05-15 08:54, Tim Graham wrote: > Does anyone know of a use case for using null bytes in > CharField/TextField? Is this not what BinaryField is for? It would seem to me that attempting to store binary NULL bytes in a CharField/TextField should result in an error condition. -tkc --

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-15 Thread Luke Plant
I agree with Adam, we should never silently change submitted data at the model layer. My preference would be c), a form-level validation error that prevents saving. Luke On 15/05/17 19:11, Adam Johnson wrote: The problem with (a) - data with null bytes in strings from other databases can't

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-15 Thread Michael Manfre
I imagine we won't hear of a use case until after the change happens and I'm some what strongly opposed to stripping potentially valid data from all databases because of a limitation of one. I'd be in favor of loaddata checking for null bytes and complaining when the backend doesn't support that

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-15 Thread Adam Johnson
The problem with (a) - data with null bytes in strings from other databases can't be loaded into PG as per #28117 . The problem with (b) - data currently in databases in the wild will be modified upon save  (b) is incredibly destructive and could break an unknown number of applications whilst

Are there use cases for storing null bytes in CharField/TextField?

2017-05-15 Thread Tim Graham
Does anyone know of a use case for using null bytes in CharField/TextField? psycopg2 2.7+ raises ValueError("A string literal cannot contain NUL (0x00) characters.") when trying to save null bytes [0] and this exception is unhandled in Django which allow malicious form submissions to crash [1].