script: prevent UB when computing abs value for num opcode serialize
Summary: Backport of core PR18413.
Test Plan:
ninja all check-all ninja bitcoin-fuzzers ./test/fuzz/test_runner.py <path_to_corpus>
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D9017