Re: libdv: missing ENDBR64

2024-02-28 Thread Mark Kettenis
> Date: Wed, 28 Feb 2024 20:10:58 +0100
> From: Theo Buehler 
> 
> This is straightforward. There doesn't seem to be a possibility of
> shortcuts via a macro, so just add endbr64 to the four functions in this
> file. I could not find code that actually uses these, but it's probably
> better to be safe than sorry.
> 
> The code is too old to have arm64 assembly.

ok kettenis@

> Index: Makefile
> ===
> RCS file: /cvs/ports/multimedia/libdv/Makefile,v
> diff -u -p -r1.28 Makefile
> --- Makefile  7 Nov 2023 14:19:39 -   1.28
> +++ Makefile  28 Feb 2024 19:01:33 -
> @@ -1,7 +1,7 @@
>  COMMENT= Quasar DV codec
>  
>  DISTNAME=libdv-1.0.0
> -REVISION=4
> +REVISION=5
>  
>  CATEGORIES=  multimedia
>  
> Index: patches/patch-libdv_vlc_x86_64_S
> ===
> RCS file: patches/patch-libdv_vlc_x86_64_S
> diff -N patches/patch-libdv_vlc_x86_64_S
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-libdv_vlc_x86_64_S  28 Feb 2024 19:00:50 -
> @@ -0,0 +1,35 @@
> +Index: libdv/vlc_x86_64.S
> +--- libdv/vlc_x86_64.S.orig
>  libdv/vlc_x86_64.S
> +@@ -6,6 +6,7 @@
> + .globl dv_decode_vlc
> + .typedv_decode_vlc,@function
> + dv_decode_vlc:
> ++endbr64
> + push %rbx
> + push %rbp
> + 
> +@@ -102,6 +103,7 @@ void __dv_decode_vlc(int bits, dv_vlc_t *result)
> + .globl __dv_decode_vlc
> + .type__dv_decode_vlc,@function
> + __dv_decode_vlc:
> ++endbr64
> + push %rbx
> + push %rbp
> + 
> +@@ -174,6 +176,7 @@ void dv_parse_ac_coeffs_pass0(bitstream_t *bs,
> + .type   dv_parse_ac_coeffs_pass0,@function
> + 
> + dv_parse_ac_coeffs_pass0:
> ++endbr64
> + 
> + /* Args are at rdi=bs, rsi=mb, rdx=bl */
> + push%r12
> +@@ -427,6 +430,7 @@ gint dv_parse_video_segment(dv_videosegment_t *seg, gu
> + .globl dv_parse_video_segment
> + .type  dv_parse_video_segment,@function
> + dv_parse_video_segment:
> ++endbr64
> + 
> + /* Args are at rdi=seg, rsi=quality */
> + push%r12
> 



Re: libdv: missing ENDBR64

2024-02-28 Thread Stuart Henderson
On 2024/02/28 20:10, Theo Buehler wrote:
> This is straightforward. There doesn't seem to be a possibility of
> shortcuts via a macro, so just add endbr64 to the four functions in this
> file. I could not find code that actually uses these, but it's probably
> better to be safe than sorry.
> 
> The code is too old to have arm64 assembly.

I found a test file at
https://downloads.sourceforge.net/project/libdv/examples/examples/pond.dv)

Not really sure how to test properly; mplayer depends on it but
actually uses libavformat to play them (and works on a build without
USE_NOBTCFI). Anyway LGTM, OK sthen@.


> Index: Makefile
> ===
> RCS file: /cvs/ports/multimedia/libdv/Makefile,v
> diff -u -p -r1.28 Makefile
> --- Makefile  7 Nov 2023 14:19:39 -   1.28
> +++ Makefile  28 Feb 2024 19:01:33 -
> @@ -1,7 +1,7 @@
>  COMMENT= Quasar DV codec
>  
>  DISTNAME=libdv-1.0.0
> -REVISION=4
> +REVISION=5
>  
>  CATEGORIES=  multimedia
>  
> Index: patches/patch-libdv_vlc_x86_64_S
> ===
> RCS file: patches/patch-libdv_vlc_x86_64_S
> diff -N patches/patch-libdv_vlc_x86_64_S
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-libdv_vlc_x86_64_S  28 Feb 2024 19:00:50 -
> @@ -0,0 +1,35 @@
> +Index: libdv/vlc_x86_64.S
> +--- libdv/vlc_x86_64.S.orig
>  libdv/vlc_x86_64.S
> +@@ -6,6 +6,7 @@
> + .globl dv_decode_vlc
> + .typedv_decode_vlc,@function
> + dv_decode_vlc:
> ++endbr64
> + push %rbx
> + push %rbp
> + 
> +@@ -102,6 +103,7 @@ void __dv_decode_vlc(int bits, dv_vlc_t *result)
> + .globl __dv_decode_vlc
> + .type__dv_decode_vlc,@function
> + __dv_decode_vlc:
> ++endbr64
> + push %rbx
> + push %rbp
> + 
> +@@ -174,6 +176,7 @@ void dv_parse_ac_coeffs_pass0(bitstream_t *bs,
> + .type   dv_parse_ac_coeffs_pass0,@function
> + 
> + dv_parse_ac_coeffs_pass0:
> ++endbr64
> + 
> + /* Args are at rdi=bs, rsi=mb, rdx=bl */
> + push%r12
> +@@ -427,6 +430,7 @@ gint dv_parse_video_segment(dv_videosegment_t *seg, gu
> + .globl dv_parse_video_segment
> + .type  dv_parse_video_segment,@function
> + dv_parse_video_segment:
> ++endbr64
> + 
> + /* Args are at rdi=seg, rsi=quality */
> + push%r12
> 



libdv: missing ENDBR64

2024-02-28 Thread Theo Buehler
This is straightforward. There doesn't seem to be a possibility of
shortcuts via a macro, so just add endbr64 to the four functions in this
file. I could not find code that actually uses these, but it's probably
better to be safe than sorry.

The code is too old to have arm64 assembly.

Index: Makefile
===
RCS file: /cvs/ports/multimedia/libdv/Makefile,v
diff -u -p -r1.28 Makefile
--- Makefile7 Nov 2023 14:19:39 -   1.28
+++ Makefile28 Feb 2024 19:01:33 -
@@ -1,7 +1,7 @@
 COMMENT=   Quasar DV codec
 
 DISTNAME=  libdv-1.0.0
-REVISION=  4
+REVISION=  5
 
 CATEGORIES=multimedia
 
Index: patches/patch-libdv_vlc_x86_64_S
===
RCS file: patches/patch-libdv_vlc_x86_64_S
diff -N patches/patch-libdv_vlc_x86_64_S
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-libdv_vlc_x86_64_S28 Feb 2024 19:00:50 -
@@ -0,0 +1,35 @@
+Index: libdv/vlc_x86_64.S
+--- libdv/vlc_x86_64.S.orig
 libdv/vlc_x86_64.S
+@@ -6,6 +6,7 @@
+ .globl dv_decode_vlc
+   .typedv_decode_vlc,@function
+ dv_decode_vlc:
++  endbr64
+   push %rbx
+   push %rbp
+ 
+@@ -102,6 +103,7 @@ void __dv_decode_vlc(int bits, dv_vlc_t *result)
+ .globl __dv_decode_vlc
+   .type__dv_decode_vlc,@function
+ __dv_decode_vlc:
++  endbr64
+   push %rbx
+   push %rbp
+ 
+@@ -174,6 +176,7 @@ void dv_parse_ac_coeffs_pass0(bitstream_t *bs,
+ .type dv_parse_ac_coeffs_pass0,@function
+ 
+ dv_parse_ac_coeffs_pass0:
++  endbr64
+   
+   /* Args are at rdi=bs, rsi=mb, rdx=bl */
+   push%r12
+@@ -427,6 +430,7 @@ gint dv_parse_video_segment(dv_videosegment_t *seg, gu
+   .globl dv_parse_video_segment
+   .type  dv_parse_video_segment,@function
+ dv_parse_video_segment:
++  endbr64
+   
+   /* Args are at rdi=seg, rsi=quality */
+   push%r12