+2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-api.h (ECTF_FLAGS): New.
+ (ECTF_NERR): Adjust.
+ * ctf.h (CTF_F_MAX): New.
+
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
* ctf-api.h (ECTF_NEXT_END): New error.
ECTF_NONREPRESENTABLE, /* Type not representable in CTF. */
ECTF_NEXT_END, /* End of iteration. */
ECTF_NEXT_WRONGFUN, /* Wrong iteration function called. */
- ECTF_NEXT_WRONGFP /* Iteration entity changed in mid-iterate. */
+ ECTF_NEXT_WRONGFP, /* Iteration entity changed in mid-iterate. */
+ ECTF_FLAGS /* CTF header contains flags unknown to libctf. */
};
-#define ECTF_NERR (ECTF_NEXT_WRONGFP - ECTF_BASE + 1) /* Count of CTF errors. */
+#define ECTF_NERR (ECTF_FLAGS - ECTF_BASE + 1) /* Count of CTF errors. */
/* The CTF data model is inferred to be the caller's data model or the data
model of the given object, unless ctf_setmodel() is explicitly called. */
#define CTF_VERSION_3 4
#define CTF_VERSION CTF_VERSION_3 /* Current version. */
-#define CTF_F_COMPRESS 0x1 /* Data buffer is compressed by libctf. */
+#define CTF_F_COMPRESS 0x1 /* Data buffer is compressed by libctf. */
+#define CTF_F_MAX CTF_F_COMPRESS /* The greatest flag value in use. */
typedef struct ctf_lblent
{
+2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-open.c (ctf_bufopen_internal): Diagnose invalid flags.
+
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
ctf-decls.h (ctf_qsort_compar_thunk): Fix arg passing.
if (pp->ctp_version < CTF_VERSION_3)
hdrsz = sizeof (ctf_header_v2_t);
+ if (_libctf_unlikely_ (pp->ctp_flags > CTF_F_MAX))
+ return (ctf_set_open_errno (errp, ECTF_FLAGS));
+
if (ctfsect->cts_size < hdrsz)
return (ctf_set_open_errno (errp, ECTF_NOCTFBUF));