]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/python: cast to ui_file_style::intensity after validating value
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 8 Oct 2025 15:50:11 +0000 (11:50 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Wed, 8 Oct 2025 15:52:55 +0000 (11:52 -0400)
commite0069711780646561ea9f028e6c5d9431782e8b4
tree7d03dfa19c6f9e3abf8bdbc8e16aa624eae33a65
parentb891d4c95d799e6b5a3c1e9b8287bc151999275a
gdb/python: cast to ui_file_style::intensity after validating value

When GDB is built with undefined behavior sanitizer,
gdb.python/py-style.exp fails because of this:

    $ ./gdb -q -nx --data-directory=data-directory -ex "python filename_style = gdb.Style('filename')" -ex "python filename_style.intensity = -3"
    /home/simark/src/binutils-gdb/gdb/python/py-style.c:239:11: runtime error: load of value 4294967293, which is not a valid value for type 'intensity'

Fix it by casting the value to ui_file_style::intensity only after
validating the raw value.

Change-Id: I38eb471a9cb3bfc3bb8b2c88afa76b8025e4e893
gdb/python/py-style.c