Project

General

Profile

Actions

Bug #12259

closed

CTF shouldn't assume enum size

Added by John Levon over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

$ cat bad-ctf.c
#include <sys/types.h>

enum http_meth_t {
        HTTP_METH_OPTIONS,
        HTTP_METH_GET,
        HTTP_METH_HEAD,
        HTTP_METH_POST,
        HTTP_METH_PUT,
        HTTP_METH_DELETE,
        HTTP_METH_TRACE,
        HTTP_METH_CONNECT,
        HTTP_METH_OTHER, /* Must be the last entry */
} __attribute__((packed));

struct htx_sl {
        unsigned int flags; /* HTX_SL_F_* */
        union {
                struct {
                        enum http_meth_t meth;   /* method */
                } req;
                struct {
                        uint16_t         status; /* status code */
                } res;
        } info;
};

struct htx_sl sl;

$ gcc -g -c -o bad-ctf.o bad-ctf.c
f905ddb5-9113-c52a-d3ce-d0db83321d72:libctf $ ctfconvert bad-ctf.o
ctfconvert: failed to set type size for 4 to 0x1: Invalid argument

Distilled from haproxy


Related issues

Related to illumos gate - Bug #12898: ctf enum size detection should use DW_AT_byte_sizeClosedRobert Mustacchi

Actions
Actions

Also available in: Atom PDF