Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libpkg and incorrect plist parsing #1

Closed
dnaeon opened this issue Mar 27, 2011 · 5 comments
Closed

libpkg and incorrect plist parsing #1

dnaeon opened this issue Mar 27, 2011 · 5 comments
Labels
Milestone

Comments

@dnaeon
Copy link
Contributor

dnaeon commented Mar 27, 2011

To have this here as well so it is not lost :)

When running ports/pkg2ng, libpkg tries to parse +COMMENT, +DESC, etc. which apparently should not be part of PLIST.

Complete logs were already added to pastebin, which contain more information on the issue.

Xtrace run of pkg2ng

@jlaffaye
Copy link
Member

Can you upload the +CONTENTS file as well? Thanks!

@dnaeon
Copy link
Contributor Author

dnaeon commented Mar 27, 2011

@jlaffaye
Copy link
Member

Ok, the issue is clear now: the awk script in pkg2ng does not ignore the lines which are preceeded by @ignore.
@bapt: can you take a look at this?

@bapt
Copy link
Member

bapt commented Mar 27, 2011

Sure I will.

@bapt bapt closed this as completed Mar 27, 2011
@bapt bapt reopened this Mar 27, 2011
@bapt
Copy link
Member

bapt commented Mar 27, 2011

ignore the line after @ignore in +CONTENTS in pkg2ng
Closed by 7d83419.

@bapt bapt closed this as completed Mar 27, 2011
opntr added a commit to opntr/pkg that referenced this issue Aug 5, 2015
The attr variables type is int, but the format string in pkg_emit_error
is %s. In some case with enabled ASLR this cause a core dump.

 441     {
 442             int attr;
 443
 444             while ((attr = va_arg(ap, int)) > 0) {
 445                     if (attr >= PKG_NUM_FIELDS || attr <= 0) {
 446                             pkg_emit_error("Bad argument on pkg_set %s", attr);
 447                             return (EPKG_FATAL);
 448                     }
 449
 450                     switch (attr) {

(gdb) bt
 #0  0x00000000007f25ab in strlen ()
 freebsd#1  0x00000000007e8062 in __vfprintf ()
 freebsd#2  0x00000000007a5747 in vasprintf_l ()
 freebsd#3  0x0000000000451e7e in pkg_emit_error (
    fmt=0x84b9f5 "Bad argument on pkg_set %s") at pkg_event.c:418
 freebsd#4  0x00000000004264c9 in pkg_vset (pkg=0x22036461600, ap=0x6529128ac3e0)
    at pkg.c:446
 freebsd#5  0x0000000000426409 in pkg_set2 (pkg=0x22036461600) at pkg.c:567
 freebsd#6  0x00000000004024a2 in exec_audit (argc=1, argv=0x6529128acd00)
    at audit.c:207
 freebsd#7  0x000000000040e22e in main (argc=2, argv=0x6529128accf8) at main.c:847

Sponsored-by: HardenedBSD
Found-by: ASLR - stack randomization
Signed-off-by: Oliver Pinter <oliver.pinter@hardenedbsd.org>
CC: Pedro Giffuni <pfg@freebsd.org
CC: Baptiste Daroussin <bapt@freebsd.org>
bapt pushed a commit that referenced this issue Aug 6, 2015
The attr variables type is int, but the format string in pkg_emit_error
is %s. In some case with enabled ASLR this cause a core dump.

 441     {
 442             int attr;
 443
 444             while ((attr = va_arg(ap, int)) > 0) {
 445                     if (attr >= PKG_NUM_FIELDS || attr <= 0) {
 446                             pkg_emit_error("Bad argument on pkg_set %s", attr);
 447                             return (EPKG_FATAL);
 448                     }
 449
 450                     switch (attr) {

(gdb) bt
 #0  0x00000000007f25ab in strlen ()
 #1  0x00000000007e8062 in __vfprintf ()
 #2  0x00000000007a5747 in vasprintf_l ()
 #3  0x0000000000451e7e in pkg_emit_error (
    fmt=0x84b9f5 "Bad argument on pkg_set %s") at pkg_event.c:418
 #4  0x00000000004264c9 in pkg_vset (pkg=0x22036461600, ap=0x6529128ac3e0)
    at pkg.c:446
 #5  0x0000000000426409 in pkg_set2 (pkg=0x22036461600) at pkg.c:567
 #6  0x00000000004024a2 in exec_audit (argc=1, argv=0x6529128acd00)
    at audit.c:207
 #7  0x000000000040e22e in main (argc=2, argv=0x6529128accf8) at main.c:847

Sponsored-by: HardenedBSD
Found-by: ASLR - stack randomization
Signed-off-by: Oliver Pinter <oliver.pinter@hardenedbsd.org>
CC: Pedro Giffuni <pfg@freebsd.org
CC: Baptiste Daroussin <bapt@freebsd.org>
bapt pushed a commit that referenced this issue Aug 11, 2015
The attr variables type is int, but the format string in pkg_emit_error
is %s. In some case with enabled ASLR this cause a core dump.

 441     {
 442             int attr;
 443
 444             while ((attr = va_arg(ap, int)) > 0) {
 445                     if (attr >= PKG_NUM_FIELDS || attr <= 0) {
 446                             pkg_emit_error("Bad argument on pkg_set %s", attr);
 447                             return (EPKG_FATAL);
 448                     }
 449
 450                     switch (attr) {

(gdb) bt
 #0  0x00000000007f25ab in strlen ()
 #1  0x00000000007e8062 in __vfprintf ()
 #2  0x00000000007a5747 in vasprintf_l ()
 #3  0x0000000000451e7e in pkg_emit_error (
    fmt=0x84b9f5 "Bad argument on pkg_set %s") at pkg_event.c:418
 #4  0x00000000004264c9 in pkg_vset (pkg=0x22036461600, ap=0x6529128ac3e0)
    at pkg.c:446
 #5  0x0000000000426409 in pkg_set2 (pkg=0x22036461600) at pkg.c:567
 #6  0x00000000004024a2 in exec_audit (argc=1, argv=0x6529128acd00)
    at audit.c:207
 #7  0x000000000040e22e in main (argc=2, argv=0x6529128accf8) at main.c:847

Sponsored-by: HardenedBSD
Found-by: ASLR - stack randomization
Signed-off-by: Oliver Pinter <oliver.pinter@hardenedbsd.org>
CC: Pedro Giffuni <pfg@freebsd.org
CC: Baptiste Daroussin <bapt@freebsd.org>
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7f85d208f547 in strdup (/lib64/libasan.so.6+0x58547)
    freebsd#1 0x497b37 in xstrdup /pkg/libpkg/xmalloc.h:34
    freebsd#2 0x497b37 in elf_note_analyse /pkg/libpkg/pkg_elf.c:780
    freebsd#3 0x497b37 in pkg_get_myarch_elfparse /pkg/libpkg/pkg_elf.c:907
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7f85d208f547 in strdup (/lib64/libasan.so.6+0x58547)
    freebsd#1 0x497b37 in xstrdup /pkg/libpkg/xmalloc.h:34
    freebsd#2 0x497b37 in elf_note_analyse /pkg/libpkg/pkg_elf.c:780
    freebsd#3 0x497b37 in pkg_get_myarch_elfparse /pkg/libpkg/pkg_elf.c:907
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7f85d208f547 in strdup (/lib64/libasan.so.6+0x58547)
    freebsd#1 0x497b37 in xstrdup /pkg/libpkg/xmalloc.h:34
    freebsd#2 0x497b37 in elf_note_analyse /pkg/libpkg/pkg_elf.c:780
    freebsd#3 0x497b37 in pkg_get_myarch_elfparse /pkg/libpkg/pkg_elf.c:907
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7f85d208f547 in strdup (/lib64/libasan.so.6+0x58547)
    freebsd#1 0x497b37 in xstrdup /pkg/libpkg/xmalloc.h:34
    freebsd#2 0x497b37 in elf_note_analyse /pkg/libpkg/pkg_elf.c:780
    freebsd#3 0x497b37 in pkg_get_myarch_elfparse /pkg/libpkg/pkg_elf.c:907
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7f85d208f547 in strdup (/lib64/libasan.so.6+0x58547)
    freebsd#1 0x497b37 in xstrdup /pkg/libpkg/xmalloc.h:34
    freebsd#2 0x497b37 in elf_note_analyse /pkg/libpkg/pkg_elf.c:780
    freebsd#3 0x497b37 in pkg_get_myarch_elfparse /pkg/libpkg/pkg_elf.c:907
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7f85d208f547 in strdup (/lib64/libasan.so.6+0x58547)
    freebsd#1 0x497b37 in xstrdup /pkg/libpkg/xmalloc.h:34
    freebsd#2 0x497b37 in elf_note_analyse /pkg/libpkg/pkg_elf.c:780
    freebsd#3 0x497b37 in pkg_get_myarch_elfparse /pkg/libpkg/pkg_elf.c:907
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7f85d208f547 in strdup (/lib64/libasan.so.6+0x58547)
    freebsd#1 0x497b37 in xstrdup /pkg/libpkg/xmalloc.h:34
    freebsd#2 0x497b37 in elf_note_analyse /pkg/libpkg/pkg_elf.c:780
    freebsd#3 0x497b37 in pkg_get_myarch_elfparse /pkg/libpkg/pkg_elf.c:907
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 3456 byte(s) in 1 object(s) allocated from:
    #0 0x7fb5ed3bf748 in __interceptor_realloc (/lib64/libasan.so.6+0xab748)
    freebsd#1 0x78992c in ucl_utstring_append_len src/ucl_emitter_utils.c:239
    freebsd#2 0x784247 in ucl_emitter_finish_object src/ucl_emitter.c:174
    freebsd#3 0x785ba1 in ucl_emitter_common_elt src/ucl_emitter.c:423
    freebsd#4 0x784f41 in ucl_emitter_common_start_object src/ucl_emitter.c:323
    freebsd#5 0x785f6b in ucl_emitter_common_elt src/ucl_emitter.c:449
    freebsd#6 0x786572 in ucl_emit_config_elt src/ucl_emitter.c:511
    freebsd#7 0x7872cb in ucl_object_emit_full src/ucl_emitter.c:681
    freebsd#8 0x786fdb in ucl_object_emit_len src/ucl_emitter.c:652
    freebsd#9 0x786ebf in ucl_object_emit src/ucl_emitter.c:633
    freebsd#10 0x5bf370 in pkg_object_dump /pkg/libpkg/pkg_object.c:38
    freebsd#11 0x5c8022 in pkg_config_dump /pkg/libpkg/pkg_config.c:560
    freebsd#12 0x43deb8 in show_version_info /pkg/src/main.c:387
    freebsd#13 0x43f614 in main /pkg/src/main.c:809
    freebsd#14 0x7fb5ec8a31e1 in __libc_start_main (/lib64/libc.so.6+0x281e1)
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 3456 byte(s) in 1 object(s) allocated from:
    #0 0x7fb5ed3bf748 in __interceptor_realloc (/lib64/libasan.so.6+0xab748)
    freebsd#1 0x78992c in ucl_utstring_append_len src/ucl_emitter_utils.c:239
    freebsd#2 0x784247 in ucl_emitter_finish_object src/ucl_emitter.c:174
    freebsd#3 0x785ba1 in ucl_emitter_common_elt src/ucl_emitter.c:423
    freebsd#4 0x784f41 in ucl_emitter_common_start_object src/ucl_emitter.c:323
    freebsd#5 0x785f6b in ucl_emitter_common_elt src/ucl_emitter.c:449
    freebsd#6 0x786572 in ucl_emit_config_elt src/ucl_emitter.c:511
    freebsd#7 0x7872cb in ucl_object_emit_full src/ucl_emitter.c:681
    freebsd#8 0x786fdb in ucl_object_emit_len src/ucl_emitter.c:652
    freebsd#9 0x786ebf in ucl_object_emit src/ucl_emitter.c:633
    freebsd#10 0x5bf370 in pkg_object_dump /pkg/libpkg/pkg_object.c:38
    freebsd#11 0x5c8022 in pkg_config_dump /pkg/libpkg/pkg_config.c:560
    freebsd#12 0x43deb8 in show_version_info /pkg/src/main.c:387
    freebsd#13 0x43f614 in main /pkg/src/main.c:809
    freebsd#14 0x7fb5ec8a31e1 in __libc_start_main (/lib64/libc.so.6+0x281e1)
arichardson added a commit to arichardson/pkg that referenced this issue Mar 17, 2021
Direct leak of 3456 byte(s) in 1 object(s) allocated from:
    #0 0x7fb5ed3bf748 in __interceptor_realloc (/lib64/libasan.so.6+0xab748)
    freebsd#1 0x78992c in ucl_utstring_append_len src/ucl_emitter_utils.c:239
    freebsd#2 0x784247 in ucl_emitter_finish_object src/ucl_emitter.c:174
    freebsd#3 0x785ba1 in ucl_emitter_common_elt src/ucl_emitter.c:423
    freebsd#4 0x784f41 in ucl_emitter_common_start_object src/ucl_emitter.c:323
    freebsd#5 0x785f6b in ucl_emitter_common_elt src/ucl_emitter.c:449
    freebsd#6 0x786572 in ucl_emit_config_elt src/ucl_emitter.c:511
    freebsd#7 0x7872cb in ucl_object_emit_full src/ucl_emitter.c:681
    freebsd#8 0x786fdb in ucl_object_emit_len src/ucl_emitter.c:652
    freebsd#9 0x786ebf in ucl_object_emit src/ucl_emitter.c:633
    freebsd#10 0x5bf370 in pkg_object_dump /pkg/libpkg/pkg_object.c:38
    freebsd#11 0x5c8022 in pkg_config_dump /pkg/libpkg/pkg_config.c:560
    freebsd#12 0x43deb8 in show_version_info /pkg/src/main.c:387
    freebsd#13 0x43f614 in main /pkg/src/main.c:809
    freebsd#14 0x7fb5ec8a31e1 in __libc_start_main (/lib64/libc.so.6+0x281e1)
bapt pushed a commit that referenced this issue Mar 18, 2021
Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7f85d208f547 in strdup (/lib64/libasan.so.6+0x58547)
    #1 0x497b37 in xstrdup /pkg/libpkg/xmalloc.h:34
    #2 0x497b37 in elf_note_analyse /pkg/libpkg/pkg_elf.c:780
    #3 0x497b37 in pkg_get_myarch_elfparse /pkg/libpkg/pkg_elf.c:907
bapt pushed a commit that referenced this issue Mar 18, 2021
Direct leak of 3456 byte(s) in 1 object(s) allocated from:
    #0 0x7fb5ed3bf748 in __interceptor_realloc (/lib64/libasan.so.6+0xab748)
    #1 0x78992c in ucl_utstring_append_len src/ucl_emitter_utils.c:239
    #2 0x784247 in ucl_emitter_finish_object src/ucl_emitter.c:174
    #3 0x785ba1 in ucl_emitter_common_elt src/ucl_emitter.c:423
    #4 0x784f41 in ucl_emitter_common_start_object src/ucl_emitter.c:323
    #5 0x785f6b in ucl_emitter_common_elt src/ucl_emitter.c:449
    #6 0x786572 in ucl_emit_config_elt src/ucl_emitter.c:511
    #7 0x7872cb in ucl_object_emit_full src/ucl_emitter.c:681
    #8 0x786fdb in ucl_object_emit_len src/ucl_emitter.c:652
    #9 0x786ebf in ucl_object_emit src/ucl_emitter.c:633
    #10 0x5bf370 in pkg_object_dump /pkg/libpkg/pkg_object.c:38
    #11 0x5c8022 in pkg_config_dump /pkg/libpkg/pkg_config.c:560
    #12 0x43deb8 in show_version_info /pkg/src/main.c:387
    #13 0x43f614 in main /pkg/src/main.c:809
    #14 0x7fb5ec8a31e1 in __libc_start_main (/lib64/libc.so.6+0x281e1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants