[Dnsmasq-discuss] runtime error: left shift of 128 by 24 places cannot be represented in type 'int'
Simon Kelley
simon at thekelleys.org.uk
Wed Nov 22 22:13:28 UTC 2023
Thanks for that. I don't think this bug has any practical effect. If the
hash is calculated wrongly, it's only ever compared to another has
calculated the same way, so the code will still work as designed.
I think that this patch fixes things. Please could you test?
https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=65c2d6afd67a032f45f40d7e4d620f5d73e5f07d
Cheers,
Simon.
On 22/11/2023 06:44, 吴非凡 wrote:
> Hello dnsmasq experts,
>
> There is a runtime error in the latest version of dnsmasq. If we
> compile dnsmasq with UBSan. and send it with
>
> ```
> echo -n 'c97b01000001000000000000047465737403636f6d0000020001' | xxd
> -r -p | nc -u target_addr target_port
> ```
>
> And then we'll get a error message:
>
> ```
> hash-questions.c:168:21: runtime error: left shift of 128 by 24 places
> cannot be represented in type 'int'
> #0 0x6f0252 in sha256_transform /root/dnsmasq/src/hash-questions.c:168:21
> #1 0x6eea82 in sha256_final /root/dnsmasq/src/hash-questions.c:267:3
> #2 0x6eea82 in hash_questions /root/dnsmasq/src/hash-questions.c:127:3
> #3 0x56d2e9 in forward_query /root/dnsmasq/src/forward.c:179:16
> #4 0x580327 in receive_query /root/dnsmasq/src/forward.c:1877:12
> #5 0x5c977f in check_dns_listeners /root/dnsmasq/src/dnsmasq.c:1838:2
> #6 0x5c0c95 in main /root/dnsmasq/src/dnsmasq.c:1259:7
> #7 0x7f3e2ec1dd8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
> #8 0x7f3e2ec1de3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
> #9 0x4206d4 in _start (/root/dnsmasq/src/dnsmasq+0x4206d4)
> ```
>
> here is my conf and cli args:
>
> ```
> no-daemon
> no-resolv
> interface=lo
> bind-interfaces
> no-hosts
> server=/baidu.com/223.5.5.5
> server=/thekelleys.org.uk/114.114.114.114
> address=/test.com/233.233.233.233
> cache-size=150
> ```
>
> ```
> dnsmasq -p 5355 -d -N -q -R -h -n -y -C config.conf
> ```
>
> Kind regards,
>
> Feifan Wu
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
>
More information about the Dnsmasq-discuss
mailing list