Want to compare packet length to length in header

I am debugging a problem where there may be short packets. The UDP protocol I am dealing with gives a packet length in its own protocol header and I want to compare that to the frame.len or IP length. I am not finding any way to place a suitable variable on the RHS of a filter equation or convert byte types to integer. I want to do something like frame.len==udp[22:2] essentially.