>
> So either, this is a bug in the way openldap uses the ber_len_t type, we
> have a mistake in our logic, or something else hokey is going on.
>
> I would like to update this to:
>
> if ( (tag != LBER_END_OF_SEQORSET) && (len == 0) && (*fstr != NULL) )
>
> Or even:
>
> if ( (tag != LBER_END_OF_SEQORSET) && (*fstr != NULL) )
>
> What do you think of this assessment given the ber_len_t type?
Looks like it's intentional by the openldap team. There are some other
areas for this problem. Specifically:
int ber_printf(BerElement *ber, const char *fmt, ...);
lber.h:79:#define LBER_ERROR ((ber_tag_t) -1)
We check if (ber_printf(...) != LBER_ERROR)
Of course, we can't satisfy either. We can't cast the LBER_ERROR from
uint -> int without changing the value of it, and we can't cast the
output of ber_printf from int -> uint, again, without potentially
changing the value of it. So it seems that the openldap library may be
impossible to satisfy the gcc type checking with -Wsign-compare.
For now, I may just avoid these in my fixes, as it seems like a whole
set of landmines I want to avoid ...
--
Sincerely,
William Brown
Software Engineer
Red Hat, Brisbane
No comments:
Post a Comment