File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 11Fixed some functions accepting unsupported flags:
22- ` xkb_context_new() `
33- ` xkb_rmlvo_builder_new() `
4+ - ` xkb_compose_state_new() `
Original file line number Diff line number Diff line change 77
88#include <assert.h>
99
10+ #include "context.h"
1011#include "table.h"
1112#include "utils.h"
1213#include "keysym.h"
@@ -33,9 +34,17 @@ struct xkb_compose_state *
3334xkb_compose_state_new (struct xkb_compose_table * table ,
3435 enum xkb_compose_state_flags flags )
3536{
36- struct xkb_compose_state * state ;
37+ static const enum xkb_compose_state_flags XKB_COMPOSE_STATE_FLAGS =
38+ XKB_COMPOSE_STATE_NO_FLAGS ;
3739
38- state = calloc (1 , sizeof (* state ));
40+ if (flags & ~XKB_COMPOSE_STATE_FLAGS ) {
41+ log_err_func (table -> ctx , XKB_LOG_MESSAGE_NO_ID ,
42+ "Unsupported compose state flags: %#x\n" ,
43+ (flags & ~XKB_COMPOSE_STATE_FLAGS ));
44+ return NULL ;
45+ }
46+
47+ struct xkb_compose_state * const state = calloc (1 , sizeof (* state ));
3948 if (!state )
4049 return NULL ;
4150
Original file line number Diff line number Diff line change @@ -487,6 +487,10 @@ test_state(struct xkb_context *ctx)
487487 assert (table );
488488 fclose (file );
489489
490+ /* Reject unsupported flags */
491+ assert (!xkb_compose_state_new (table , -1 ));
492+ assert (!xkb_compose_state_new (table , 0xffff ));
493+
490494 state = xkb_compose_state_new (table , XKB_COMPOSE_STATE_NO_FLAGS );
491495 assert (state );
492496
You can’t perform that action at this time.
0 commit comments