Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/KXL.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define _KXLIB_H_

#include <stdio.h>
#include <stdint.h>
#include <limits.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

Expand Down Expand Up @@ -152,8 +154,8 @@ typedef signed char Sint8;
typedef unsigned char Uint8;
typedef signed short Sint16;
typedef unsigned short Uint16;
typedef signed long Sint32;
typedef unsigned long Uint32;
typedef int32_t Sint32;
typedef uint32_t Uint32;
// Image
typedef struct {
Pixmap Buffer; // Drawing image
Expand Down
2 changes: 1 addition & 1 deletion src/KXLsound.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void KXL_SoundServer(void)
if (KXL_SoundData.PlaySound[i].Active == False)
continue;
sample_ptr = KXL_SoundData.PlaySound[i].Pos+KXL_SoundData.PlaySound[i].Cnt;
sample_size = MIN(max_sample_size, KXL_SoundData.PlaySound[i].Length - KXL_SoundData.PlaySound[i].Cnt);
sample_size = MIN(max_sample_size, ((Sint32)KXL_SoundData.PlaySound[i].Length) - (Sint32)KXL_SoundData.PlaySound[i].Cnt);
Copy link
Owner Author

@Quipyowert2 Quipyowert2 Sep 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for the length to overflow if it is > ~2 GB?

KXL_SoundData.PlaySound[i].Cnt += sample_size;
memcpy(KXL_SoundData.FBuff, sample_ptr, sample_size);
if (KXL_SoundData.PlaySound[i].Action == KXL_SOUND_PLAY_LOOP &&
Expand Down