[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: qbittorrent 1.1.0beta3: FTBFS on arm arches



Cristian Greco <cgreco@cs.unibo.it> writes:

> Otherwise (in order to fix the code in a clean way only for involved
> arches), I guess we need to use some specific #define for arm{,el} (does
> QT_ARCH_ARM is really suited for this purpose?).
>
> --- qbittorrent-1.1.0beta3.orig/src/realprogressbarthread.cpp
> +++ qbittorrent-1.1.0beta3/src/realprogressbarthread.cpp
> @@ -142,9 +142,17 @@
>  		end = array.size();
>  	int start_int, end_int;
>  	qreal temp, start_frac, end_frac;
> +#ifdef (QT_ARCH_ARM)
> +	start_frac = modf(start, (double *) &temp);
> +#else
>  	start_frac = modf(start, &temp);
> +#endif
>  	start_int = (int) temp;
> +#ifdef (QT_ARCH_ARM)
> +	end_frac = modf(end, (double *) &temp);
> +#else
>  	end_frac = modf(end, &temp);
> +#endif
>  	end_int = (int) temp;
>  	if(start_int == end_int)
>  	{

If temp is actually a float and sizeof(float) != sizeof(double), I believe
this code is not safe.  It takes the space pointed to by temp and blindly
interprets it as a double, meaning that if sizeof(float) < sizeof(double),
you're storing part of the result in adjacent memory.

I think you have to change the type of temp from a qreal to a double for
the code to be safe (and then check the adjacent code to make sure that
doesn't break anything else).

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: