On 8 Sep 2014, at 11:47am, Andres Riancho <andres.rian...@gmail.com> wrote:

> On Sun, Sep 7, 2014 at 11:39 PM, Simon Slavin <slav...@bigfraud.org> wrote:
> 
>> There are two possibilities:
>> 
>> A) The database really is malformed
>> B) The client's copy of SQLite is returning that code by mistake.
>> 
>> Can you have one of these clients send you a copy of their database after 
>> they have received this message ?  Then you can try and open it yourself and 
>> see whether it really is malformed.
> 
> Let's say that it is possible for me to do that (ask users to submit
> their DBs and actually get one), I receive it and then:
> 1- Open -> Get database malformed error
> 2- Open -> Can read the database
> 
> In any of the cases, I can't imagine what to do next.

For diagnostic purposes mainly.  Just see whether you get (1) or (2).  If you 
get (2) then you know your fault is messing up your program's memory rather 
than writing gibberish over the database file.  It just tells you part of your 
code to check more carefully.

>> All the incidents like this I can remember have been the result of bad 
>> memory management or using stale pointers.  It's likely that you will 
>> eventually find that some other process is overwriting SQLite's memory or 
>> writing to the database file.
> 
> Oh, so you believe that maybe if the database is really malformed I'll
> find "garbage" that shouldn't be there using a hex editor, and by
> understanding what that garbage is (lets say log messages that should
> go to stderr) I can fix the issue on my software? That would be an
> outcome of #2 above?

An outcome of #1.  Exactly.  Sometimes the thing you find written over your 
database file tells you what went wrong.  For instance, years ago I once found 
a configuration file corrupted with text including the string "Account slavin 
logged off.".  Since that string didn't get created before a certain point in 
my program it told me which part of the program was messing up its memory 
handling.  It turned out that I was referring to a pass-by-reference variable 
as if it was pass-by-value."

>> But it's possible you've found a genuine bug in SQLite and we'll try to help.
> 
> Well, this should be really unlikely, right?

We hope so.  It's tempting to write things like "SQLite has billions of happy 
installations there are no bugs in it you idiot." but a few obscure bugs are 
found every year.  Nevertheless they tend to be bugs that require an odd or 
unlikely combination of things to trigger them rather than basic file handling 
faults.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to