Closed Bug 126462 Opened 18 years ago Closed 8 years ago

Occurences of uninitialized variables being used before being set (in directory/c-sdk).

Categories

(Directory :: LDAP C SDK, defect, P1)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mozilla-bugs, Assigned: mcs)

References

Details

(Whiteboard: needs commit to ldapcsdk_50_client_branch)

Attachments

(2 files, 2 obsolete files)

This bug is just for the warnings in various source files in
directory/c-sdk/ldap/libraries/libldap. Currently
(http://tinderbox.mozilla.org/SeaMonkey/warn1014136200.29882.html - Tue, 19 Feb
2002 11:30 EST) TBox shows the following warnings:

directory/c-sdk/ldap/libraries/libldap/error.c:329
 `errcode' might be used uninitialized in this function

directory/c-sdk/ldap/libraries/libldap/utf8.c:111
 `c' might be used uninitialized in this function

(Note - because of TBox bug 124614 TBox actually shows these warnings as
happening to error.c and utf8.c in NSS, but examiming the build log reveals that
they actually happen in libldap)
Bug 59652 is the meta-bug tracking the fight against these (potentially very
nasty) warnings.

P.S. Trying to make sure that 1.0 has as little warnings as possible.

Blocks: 59652
The ldap_utf8getcc() code (in utf8.c) includes a switch statement without a
default case. The variable c is assigned in every case within the switch, and
the value switched on is guaranteed to match one of the cases. We could just
initialize the variable c to zero to make the warning go away. But there is not
a bug there.

The ldap_parse_result() code (in error.c) does have a bug. The function returns
a "failure" result code in one case, but sets another int * pointer that was
passed in to a potentially uninitialized value. As long as all callers check the
function's main return code, nothing bad will happen. But we should avoid using
errcode if it has not been set (specifically, if parsing the LDAP result message
fails for some reason).

Dan, how close are you to switching to the ldapcsdk_branch_50 code? Should I fix
these warnings on LDAPCSDK_40_BRANCH or wait?
Current
(http://tinderbox.mozilla.org/showlog.cgi?log=SeaMonkey/1017613860.20014.gz&fulltext=1
, Sun, 31 Mar 2002 17:31 EST) list of warnings in there:

directory/c-sdk/ldap/libraries/liblber/io.c:656
 `newlen' might be used uninitialized in this function
 `tag' might be used uninitialized in this function

directory/c-sdk/ldap/libraries/libldap/error.c:345
 `errcode' might be used uninitialized in this function

directory/c-sdk/ldap/libraries/libldap/os-ip.c:538
 `rc' might be used uninitialized in this function
 `s' might be used uninitialized in this function

directory/c-sdk/ldap/libraries/libldap/os-ip.c:542
 `ldhpbuf_allocd' might be used uninitialized in this function

directory/c-sdk/ldap/libraries/libldap/request.c:356
 `rc' might be used uninitialized in this function

directory/c-sdk/ldap/libraries/libldap/request.c:889
 `rc' might be used uninitialized in this function

directory/c-sdk/ldap/libraries/libldap/result.c:270
 `lr' might be used uninitialized in this function

directory/c-sdk/ldap/libraries/libldap/search.c:789
 `firstdigit' might be used uninitialized in this function

directory/c-sdk/ldap/libraries/libldap/utf8.c:112
 `c' might be used uninitialized in this function
Priority: -- → P1
Whiteboard: needs work
Status: NEW → ASSIGNED
Target Milestone: --- → 5.11
Mass move of several bugs to TM 5.12.
Target Milestone: 5.11 → 5.12
Summary: Occurances of uninitialized variables being used before being set (in directory/c-sdk). → Occurences of uninitialized variables being used before being set (in directory/c-sdk).
Whiteboard: needs work
Attached patch preliminary patch (obsolete) — Splinter Review
Attachment #118108 - Attachment is obsolete: true
OK.
Comment on attachment 118294 [details] [diff] [review]
proposed fix: eliminate warnings

Seeking sr approval for commit to ldapcsdk_50_client_branch
Attachment #118294 - Flags: superreview?(dmose)
Fix committed to the trunk:

mozilla/directory/c-sdk/ldap/clients/tools/ldapdelete.c
  new revision: 5.3; previous revision: 5.2
mozilla/directory/c-sdk/ldap/clients/tools/ldapmodify.c
  new revision: 5.3; previous revision: 5.2
mozilla/directory/c-sdk/ldap/clients/tools/ldapsearch.c
  new revision: 5.6; previous revision: 5.5
mozilla/directory/c-sdk/ldap/libraries/liblber/io.c
  new revision: 5.1; previous revision: 5.0
mozilla/directory/c-sdk/ldap/libraries/libldap/cache.c
  new revision: 5.1; previous revision: 5.0
mozilla/directory/c-sdk/ldap/libraries/libldap/error.c
  new revision: 5.1; previous revision: 5.0
mozilla/directory/c-sdk/ldap/libraries/libldap/os-ip.c
  new revision: 5.6; previous revision: 5.5
mozilla/directory/c-sdk/ldap/libraries/libldap/request.c
  new revision: 5.2; previous revision: 5.1
mozilla/directory/c-sdk/ldap/libraries/libldap/result.c
  new revision: 5.1; previous revision: 5.0
mozilla/directory/c-sdk/ldap/libraries/libldap/search.c
  new revision: 5.1; previous revision: 5.0
mozilla/directory/c-sdk/ldap/libraries/libldap/utf8.c
  new revision: 5.1; previous revision: 5.0
mozilla/directory/c-sdk/ldap/libraries/libssldap/clientinit.c
  new revision: 5.4; previous revision: 5.3
mozilla/directory/c-sdk/ldap/libraries/libssldap/ldapsinit.c
  new revision: 5.7; previous revision: 5.6
    Fix 126462 - Occurences of uninitialized variables being used
                 before being set (in directory/c-sdk).
Attached patch additional fix for debug build (obsolete) — Splinter Review
Added a rule to build etest, which is handy for testing.
Attachment #118322 - Attachment is obsolete: true
Additional fix committed to the trunk:

mozilla/directory/c-sdk/ldap/libraries/liblber/Makefile.client
  new revision: 5.1; previous revision: 5.0
mozilla/directory/c-sdk/ldap/libraries/liblber/io.c
  new revision: 5.2; previous revision: 5.1
    Follow up fix for 126462 - Occurences of uninitialized variables being
                               used before being set (in directory/c-sdk).
        Fix debug build.
Attachment #118325 - Flags: superreview?(dmose)
Comment on attachment 118325 [details] [diff] [review]
revised additional fix: debug build and rule for etest target

sr=dmose
Attachment #118325 - Flags: superreview?(dmose) → superreview+
Comment on attachment 118294 [details] [diff] [review]
proposed fix: eliminate warnings

sr=dmose@mozilla.org
Attachment #118294 - Flags: superreview?(dmose) → superreview+
Spam for bug 129472
QA Contact: nobody → nobody
Whiteboard: needs commit to ldapcsdk_50_client_branch
It looks as though this bug has been fixed.  What do we need to do to resolve it?
I am not sure if the fix has been committed to the client branch
(ldapcsdk_50_client_branch).  I suspect not.
I don't think we still have libldap in mozilla source code (could not find in m-c repository).
Closing this issue. If one finds this issue is still valid please reopen it.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
(In reply to Atul Aggarwal from comment #18)
> I don't think we still have libldap in mozilla source code (could not find
> in m-c repository).

If it wasn't we'd have closed the product/component, however the LDAP c-sdk lives on here:

http://hg.mozilla.org/projects/ldap-sdks/

and Thunderbird and SeaMonkey still use it.

That said based on comment 16-17, I think this can be marked fixed (we no longer use the 50 client branch).
Resolution: WORKSFORME → FIXED
Mark, I have limited knowledge of mozilla sources. Please feel free to open an issue which I might have closed due to my limited knowledge.
Thanks for clarifying about ldap.
You need to log in before you can comment on or make changes to this bug.