>Number: 175491 >Category: bin >Synopsis: elf_getdata may return NULL without setting error-message >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 21 21:20:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Mikhail T. >Release: FreeBSD 9.1-PRERELEASE amd64 >Organization: Virtual Estates, Inc. http://sybpipe.com/ >Environment: System: 9.1-PRERELEASE r244476: Wed Dec 19 23:40:59 EST 2012
>Description: The manual page for elf_getdata(3) assures, that a valid pointer will be returned unless there is an error. In case of an error, elf_errno(3) will return the error-code. Unfortunately, that is not always the case -- for a section 0 elf_getdata will return NULL without also setting the error-code: scn = elf_getscn(elf, 0); data = elf_getdata(scn, NULL); The traditional implementation, also known as libelf.so.0, sets the error to ERROR_NULLSCN, with a textual description of "Request error: can't manipulate null section" >How-To-Repeat: I'm including a test-program that opens the argument (or its own executable) and reproduces the problem, when compiled and linked against FreeBSD's libelf: ./libelftest elfversion returned 1 libelftest: ./libelftest: elf_getscn: (null) ... When compiled and linked against libelf.so.0 installed by the devel/libelf port, the result follows the expectation: ./libelftest elfversion returned 1 libelftest: ./libelftest: elf_getscn: Request error: can't manipulate null section >Fix: >Release-Note: >Audit-Trail: >Unformatted: _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"