Hello,
On Sep 15, 2010, at 12:12 PM, Viktor TARASOV wrote:
>> Not yet! I had to replace line 122 of iso7816.c
>> > assert(count <= card->max_recv_size);
>> by
>> > assert(count <= card->max_recv_size>0 ? card->max_recv_size : 256);
>> 
>> And then everything worked as expected.
> 
> The same concerns 'max_send_size'.
> Attached diff that 'works for me' for the 'update_binary' operation.
Thanks, now it should be changed in all places inside libopensc that made use 
of it, including muscle.h.

About assert-s. I added the possibility to use --disable-assert when 
configuring OpenSC, this should be used by all binary distributions.
Most of the asserts are from very early days of OpenSC and check for obvious 
errors like NULL pointers, that should be handled long before execution reaches 
those functions.

If somebody finds the time, some of those asserts should be reviewed and higher 
level callers fixed so that such situations would be guaranteed not to happen.

I'm not outright religious about asserts in "production code" but if they do 
exist in non-developer code, they should be somewhat helpful, so that there 
would be a theoretical chance of hitting an assert in real life, if certain 
(foreseeable/exotic) conditions are met.

Some uses of assert (like "default: assert(0);") should not be used and most of 
the time a proper error code should be returned (SC_ERROR_INTERNAL? 
SC_ERROR_INCORRECT_PARAMETERS is already overloaded with different semantics 
(error in card command parameters and error in function parameters)


-- 
Martin Paljak
@martinpaljak.net
+3725156495

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to