Skip to content

CB_HANDLER not ensuring that callback exists for helpers #108

@reidspreiter

Description

@reidspreiter

When a helper is called by CB_HANDLER, the callback function is not checked for NULL, but it is checked before being called directly:

#define CB_HANDLER(name)						       \
	case CB_TYPE_##name :						       \
	{								       \
		const struct name ## _callback *cb = &callback->callback.name ;\
		if (cb && cb->helper) {					       \
			CKINT(cb->helper(processdata, parsed_flags, testvector,\
					 testresults, cb->fn, cb->vector));    \
		} else if (cb && cb->fn) {				       \
			CKINT(cb->fn(cb->vector, parsed_flags));	

I set some ecdsa_backend callbacks to NULL because I don't build the openssl code used by the callbacks. This caused a crash when testing vectors instead of returning EOPNOTSUPP.

Is this expected behavior? If not, I attached a simple patch I used to fix this on my end.

parser_common.patch

Thanks,
Reid

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions