Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCHv2 1/2] lavc/vorbisdec: use ptrdiff_t to iterate over intptr_t
@ 2022-09-19 15:35 remi
  2022-09-19 15:48 ` James Almer
  0 siblings, 1 reply; 6+ messages in thread
From: remi @ 2022-09-19 15:35 UTC (permalink / raw)
  To: ffmpeg-devel

From: Rémi Denis-Courmont <remi@remlab.net>

While this probably never overflows, we are better safe than sorry.

The callback prototype should probably also use ptrdiff_t or size_t,
but I diggress (this would affect the DSP callback prototype).
---
 libavcodec/vorbisdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 38a5367be3..bfc4be6fc6 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1581,8 +1581,7 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
 
 void ff_vorbis_inverse_coupling(float *mag, float *ang, intptr_t blocksize)
 {
-    int i;
-    for (i = 0;  i < blocksize;  i++) {
+    for (ptrdiff_t i = 0; i < blocksize; i++) {
         if (mag[i] > 0.0) {
             if (ang[i] > 0.0) {
                 ang[i] = mag[i] - ang[i];
-- 
2.37.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-19 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 15:35 [FFmpeg-devel] [PATCHv2 1/2] lavc/vorbisdec: use ptrdiff_t to iterate over intptr_t remi
2022-09-19 15:48 ` James Almer
2022-09-19 16:06   ` Rémi Denis-Courmont
2022-09-19 16:10   ` [FFmpeg-devel] [PATCHv3 1/3] " remi
2022-09-19 16:10   ` [FFmpeg-devel] [PATCHv3 2/3] lavc/vorbisdsp: use ptrdiff_t rather than intptr_t remi
2022-09-19 16:10   ` [FFmpeg-devel] [PATCHv3 3/3] lavc/vorbisdec: use intermediate variables remi

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git