On Sat, Sep 27, 2014 at 04:02:31PM +0200, Emilio Pozuelo Monfort wrote:
> On 23/09/14 15:44, Emilio Pozuelo Monfort wrote:
> > Source: freerdp
> > Version: 1.1.0~git20140921.1.440916e+dfsg1-1
> > Severity: serious
> > 
> > See 
> > https://buildd.debian.org/status/logs.php?pkg=freerdp&ver=1.1.0~git20140921.1.440916e%2Bdfsg1-1
> 
> Any news on this? The freeze is approaching and you introduced a library
> transition after the transition freeze, so unless this is fixed RSN we'll have
> to look at disabling RDP support from the rdeps (I already checked vlc and
> vinagre) so they are not blocked on this and we can remove this from Jessie if
> the bugs aren't fixed.

I have just done an NMU to fix this issue. You will find the patch
attached, and I also pushed the changes to the git repository on
collab-maint.

Aurelien


-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurel...@aurel32.net                 http://www.aurel32.net
diff -Nru freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/changelog freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/changelog
--- freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/changelog	2014-09-22 21:40:59.000000000 +0200
+++ freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/changelog	2014-09-28 18:52:09.000000000 +0200
@@ -1,3 +1,17 @@
+freerdp (1.1.0~git20140921.1.440916e+dfsg1-1.1) unstable; urgency=medium
+
+  [ Aurelien Jarno ]
+  * Non-maintainer upload.
+  * Fix testsuite issues (closes: #762591):
+    - Add 1004_64-bit-architectures.patch to correctly support non-amd64
+      64-bit architectures.
+    - Add 1005_parse-buffer-endianess.patch to correctly parse RDP buffer
+      on bug endian architectures.
+    - Add 1006_test-unicode-endianess.patch to convert the expected
+      results from native endian to little endian.
+
+ -- Aurelien Jarno <aure...@debian.org>  Sun, 28 Sep 2014 18:51:09 +0200
+
 freerdp (1.1.0~git20140921.1.440916e+dfsg1-1) unstable; urgency=medium
 
   [ Mike Gabriel ]
diff -Nru freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1004_64-bit-architectures.patch freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1004_64-bit-architectures.patch
--- freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1004_64-bit-architectures.patch	1970-01-01 01:00:00.000000000 +0100
+++ freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1004_64-bit-architectures.patch	2014-09-28 18:52:09.000000000 +0200
@@ -0,0 +1,27 @@
+The current definitions wrongly assume the only 64-bit architecture is
+x86-64. Use the __ILP64__, __LP64__ and __LLP64__ to correctly define
+the size of a long and of pointer.
+
+Ideally long, intptr_t and uintptr_t should be used directly but there
+might be a (portability ?) reason why it is not the case.
+
+--- a/winpr/include/winpr/wtypes.h
++++ b/winpr/include/winpr/wtypes.h
+@@ -37,7 +37,7 @@
+ #define __int32 int
+ #define __int64 long long
+ 
+-#if __x86_64__
++#if __ILP64__ || __LP64__
+ #define __int3264 __int64
+ #else
+ #define __int3264 __int32
+@@ -136,7 +136,7 @@ typedef void *PVOID64, *LPVOID64;
+ typedef const void *LPCVOID;
+ typedef unsigned short WORD, *PWORD, *LPWORD;
+ 
+-#if __x86_64__
++#if __ILP64__ || __LP64__ || __LLP64__
+ typedef __int64 INT_PTR;
+ typedef unsigned __int64 UINT_PTR;
+ #else
diff -Nru freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1005_parse-buffer-endianess.patch freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1005_parse-buffer-endianess.patch
--- freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1005_parse-buffer-endianess.patch	1970-01-01 01:00:00.000000000 +0100
+++ freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1005_parse-buffer-endianess.patch	2014-09-28 18:52:09.000000000 +0200
@@ -0,0 +1,67 @@
+The RDP file buffers contain little endian UTF-16, but all the wcs* and
+UTF conversion functions use the WCHAR type and assume native endian.
+Convert the buffer to little endian on big endian machines.
+
+--- a/client/common/file.c
++++ b/client/common/file.c
+@@ -42,6 +42,18 @@
+ 
+ #include <winpr/crt.h>
+ 
++#if defined(WIN32) || defined(WIN64)
++  #ifndef __LITTLE_ENDIAN
++    #define __LITTLE_ENDIAN 1234
++    #define __BIG_ENDIAN    4321
++  #endif
++  #ifndef __BYTE_ORDER
++    #define __BYTE_ORDER __LITTLE_ENDIAN
++  #endif
++#else
++  #include <endian.h>
++#endif
++
+ #define DEBUG_CLIENT_FILE	1
+ 
+ static BYTE BOM_UTF16_LE[2] = { 0xFF, 0xFE };
+@@ -364,7 +376,8 @@
+ 
+ BOOL freerdp_client_parse_rdp_file_buffer_unicode(rdpFile* file, BYTE* buffer, size_t size)
+ {
+-	int length;
++	int i, length;
++	BYTE* bufferne;
+ 	WCHAR* line;
+ 	WCHAR* type;
+ 	WCHAR* context;
+@@ -372,7 +385,19 @@
+ 	WCHAR *beg, *end;
+ 	WCHAR *name, *value;
+ 
+-	line = wcstok_s((WCHAR*) buffer, CR_LF_STR_W, &context);
++#if __BYTE_ORDER == __BIG_ENDIAN
++	/* Convert the buffer from little endian to native endian */
++	bufferne = (BYTE*) malloc(size);
++	for (i = 0; i < size / 2; i++)
++	{
++		bufferne[i*2]  = buffer[i*2 + 1];
++		bufferne[i*2 + 1]  = buffer[i*2];
++	}
++#else
++	bufferne = buffer;
++#endif
++
++	line = wcstok_s((WCHAR*) bufferne, CR_LF_STR_W, &context);
+ 
+ 	while (line != NULL)
+ 	{
+@@ -425,6 +450,10 @@
+ 		line = wcstok_s(NULL, CR_LF_STR_W, &context);
+ 	}
+ 
++#if __BYTE_ORDER == __BIG_ENDIAN
++	free(bufferne);
++#endif
++
+ 	return TRUE;
+ }
+ 
diff -Nru freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1006_test-unicode-endianess.patch freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1006_test-unicode-endianess.patch
--- freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1006_test-unicode-endianess.patch	1970-01-01 01:00:00.000000000 +0100
+++ freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/1006_test-unicode-endianess.patch	2014-09-28 18:52:09.000000000 +0200
@@ -0,0 +1,102 @@
+The testsuite stores the expected result in little endian UTF-16, while
+all the functions UTF conversion functions use the WCHAR type and assume
+native endian. Convert the expected results to little endian on big
+endian machines.
+
+--- a/winpr/libwinpr/crt/test/TestUnicodeConversion.c
++++ b/winpr/libwinpr/crt/test/TestUnicodeConversion.c
+@@ -4,6 +4,18 @@
+ #include <winpr/error.h>
+ #include <winpr/windows.h>
+ 
++#if defined(WIN32) || defined(WIN64)
++  #ifndef __LITTLE_ENDIAN
++    #define __LITTLE_ENDIAN 1234
++    #define __BIG_ENDIAN    4321
++  #endif
++  #ifndef __BYTE_ORDER
++    #define __BYTE_ORDER __LITTLE_ENDIAN
++  #endif
++#else
++  #include <endian.h>
++#endif
++
+ /* Letters */
+ 
+ static BYTE c_cedilla_UTF8[] = "\xC3\xA7\x00";
+@@ -108,6 +120,22 @@
+ 	}
+ }
+ 
++void utf16_le_to_ne(BYTE *data, int length)
++{
++#if __BYTE_ORDER == __BIG_ENDIAN
++	int i;
++
++	for (i = 0; i < length / 2; i++)
++	{
++		BYTE c;
++
++		c = data[i * 2];
++		data[i * 2] = data[i * 2 + 1];
++		data[i * 2 + 1] = c;
++	}
++#endif
++}
++
+ int convert_utf8_to_utf16(BYTE* lpMultiByteStr, BYTE* expected_lpWideCharStr, int expected_cchWideChar)
+ {
+ 	int length;
+@@ -247,6 +275,7 @@
+ 	/* Letters */
+ 
+ 	printf("Letters\n");
++	utf16_le_to_ne(c_cedilla_UTF16, sizeof(c_cedilla_UTF16));
+ 
+ 	if (convert_utf8_to_utf16(c_cedilla_UTF8, c_cedilla_UTF16, c_cedilla_cchWideChar) < 1)
+ 		return -1;
+@@ -257,6 +286,8 @@
+ 	/* English */
+ 
+ 	printf("English\n");
++	utf16_le_to_ne(en_Hello_UTF16, sizeof(en_Hello_UTF16));
++	utf16_le_to_ne(en_HowAreYou_UTF16, sizeof(en_HowAreYou_UTF16));
+ 
+ 	if (convert_utf8_to_utf16(en_Hello_UTF8, en_Hello_UTF16, en_Hello_cchWideChar) < 1)
+ 		return -1;
+@@ -271,6 +302,8 @@
+ 	/* French */
+ 
+ 	printf("French\n");
++	utf16_le_to_ne(fr_Hello_UTF16, sizeof(fr_Hello_UTF16));
++	utf16_le_to_ne(fr_HowAreYou_UTF16, sizeof(fr_HowAreYou_UTF16));
+ 
+ 	if (convert_utf8_to_utf16(fr_Hello_UTF8, fr_Hello_UTF16, fr_Hello_cchWideChar) < 1)
+ 		return -1;
+@@ -285,6 +318,8 @@
+ 	/* Russian */
+ 
+ 	printf("Russian\n");
++	utf16_le_to_ne(ru_Hello_UTF16, sizeof(ru_Hello_UTF16));
++	utf16_le_to_ne(ru_HowAreYou_UTF16, sizeof(ru_HowAreYou_UTF16));
+ 
+ 	if (convert_utf8_to_utf16(ru_Hello_UTF8, ru_Hello_UTF16, ru_Hello_cchWideChar) < 1)
+ 		return -1;
+@@ -299,6 +334,8 @@
+ 	/* Arabic */
+ 
+ 	printf("Arabic\n");
++	utf16_le_to_ne(ar_Hello_UTF16, sizeof(ar_Hello_UTF16));
++	utf16_le_to_ne(ar_HowAreYou_UTF16, sizeof(ar_HowAreYou_UTF16));
+ 
+ 	if (convert_utf8_to_utf16(ar_Hello_UTF8, ar_Hello_UTF16, ar_Hello_cchWideChar) < 1)
+ 		return -1;
+@@ -313,6 +350,8 @@
+ 	/* Chinese */
+ 
+ 	printf("Chinese\n");
++	utf16_le_to_ne(ch_Hello_UTF16, sizeof(ch_Hello_UTF16));
++	utf16_le_to_ne(ch_HowAreYou_UTF16, sizeof(ch_HowAreYou_UTF16));
+ 
+ 	if (convert_utf8_to_utf16(ch_Hello_UTF8, ch_Hello_UTF16, ch_Hello_cchWideChar) < 1)
+ 		return -1;
diff -Nru freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/series freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/series
--- freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/series	2014-09-22 21:38:45.000000000 +0200
+++ freerdp-1.1.0~git20140921.1.440916e+dfsg1/debian/patches/series	2014-09-28 18:52:09.000000000 +0200
@@ -1,4 +1,7 @@
 1001_hide-internal-symbols.patch
 1002_update-pkg-config-file.patch
 1003_multi-arch-include-path.patch
+1004_64-bit-architectures.patch
+1005_parse-buffer-endianess.patch
+1006_test-unicode-endianess.patch
 2001_detect-ffmpeg-on-Debian.patch

Reply via email to