List Archive

Thread

Thread Index

Message

From: Andreas Falkenhahn <andreas%falkenhahn.com@localhost>
To: libzip-discuss%nih.at@localhost
Subject: Error inconsistency between zip_open() and zip_open_from_source()
Date: Mon, 1 Jan 2018 15:54:10 +0100

In zip_open() the "errorp" parameter may be NULL but in zip_open_from_source()
it must be set. Since both APIs are described on the very same man page I think
there is a high chance of developers passing NULL to zip_open_from_source()
as well because it is allowed in zip_open(). I did it as well and haven't
notice it until now when I saw that zip_open_from_source() crashed with non-
zip files.

That's why I'm proposing to either add an EXPLICIT note that "ze" must not
be NULL to the man page or change the implementation of zip_open_from_source()
to allow a NULL parameter for "ze".

I'd prefer the second idea because in most use cases you aren't really
interested in why exactly zip_open_from_source() failed so it would be more
convenient if it were possible to set the error parameter to NULL in
zip_open_from_source() as well.

-- 
Best regards,
 Andreas Falkenhahn                          
mailto:andreas%falkenhahn.com@localhost

Made by MHonArc.