[k3b] [Bug 382941] Segfault from getSupportedWriteSpeedsVia2A
Leslie Zhai
bugzilla_noreply at kde.org
Mon Aug 14 03:45:28 UTC 2017
https://bugs.kde.org/show_bug.cgi?id=382941
--- Comment #13 from Leslie Zhai <lesliezhai at llvm.org.cn> ---
> Firstly, k3bdeviceglobals.cpp line 215- can revert to:
>
> quint16 K3b::Device::from2Byte(const unsigned char* d)
> {
> if (d == NULL) {
> qWarning() << "Invalid Byte!";
https://github.com/KDE/k3b/commit/4c8e704345a75076ef639dd748483512a7c4d52d
>
> Now, the actual fix. data.size() returns (for me) 34 so (34 - 32 - 8)
> becomes negative which is then assigned to an unsigned int.
what 32 stands for? and why minus 8? where the *magic number* comes from?
>
> Here's my workaround:
> k3bdevice.cpp 3241
>
> // Ensure number of descriptors claimed actually fits in the data
> // returned by the mode sense command.
> if ((data.size() - 32 - 8) > 0) {
> if( static_cast<int>( numDesc ) > ((data.size() - 32 - 8) / 4) )
> numDesc = (data.size() - 32 - 8) / 4;
> }
>
> cd_wr_speed_performance* wr = (cd_wr_speed_performance*)mm->wr_speed_des;
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the k3b
mailing list