[k3b] [Bug 382941] Segfault from getSupportedWriteSpeedsVia2A
Matthias Schwarzott
bugzilla_noreply at kde.org
Fri Aug 11 16:51:57 UTC 2017
https://bugs.kde.org/show_bug.cgi?id=382941
Matthias Schwarzott <zzam at gentoo.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |zzam at gentoo.org
--- Comment #7 from Matthias Schwarzott <zzam at gentoo.org> ---
Commit 7f0be6a33b8260f7789c6aeed58be8d1c844229a seems to have broken detection
of the burn device / existing empty media to burn on.
I get a lot of lines printing "Invalid Byte!" the other errors:
[...]
Invalid Byte!
(K3b::Device::Device) "/dev/sr0" : Missing modepage 0x05 data.
(K3b::Device::Device) "/dev/sr0" : Cannot check write modes.
[...]
Looking at the code:
from{2,4}Byte seems to be used to read 16/32bit big endian integer values from
raw data.
So calling strlen is just wrong. This leads to rejecting valid byte-streams
containing zero bytes.
Second: I suggest to improve the unit test with a test parsing good 16 and
32bit values (at least one with all values != 0 and one where 0 values are
part).
e.g. for from2Byte
+ unsigned const char buf0[] = { 0x00, 0x00 };
+ QCOMPARE(K3b::Device::from2Byte(buf0), (quint16)0x0000);
+ unsigned const char buf1[] = { 0x00, 0x70 };
+ QCOMPARE(K3b::Device::from2Byte(buf1), (quint16)0x0070);
+ unsigned const char buf2[] = { 0x05, 0x00 };
+ QCOMPARE(K3b::Device::from2Byte(buf2), (quint16)0x0500);
+ unsigned const char buf3[] = { 0xF0, 0x03 };
+ QCOMPARE(K3b::Device::from2Byte(buf2), (quint16)0xF003);
the same should be done for from4Byte
+ unsigned const char buf0[] = { 0x00, 0x00, 0x00, 0x00 };
+ QCOMPARE(K3b::Device::from4Byte(buf0), (quint32)0x00000000);
+ unsigned const char buf0[] = { 0x00, 0x00, 0x00, 0x01 };
+ QCOMPARE(K3b::Device::from4Byte(buf0), (quint32)0x00000001);
+ unsigned const char buf0[] = { 0x12, 0x34, 0x56, 0x78 };
+ QCOMPARE(K3b::Device::from4Byte(buf0), (quint32)0x12345678);
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the k3b
mailing list