prevent crash in crop_image function

This commit is contained in:
GenevensiS
2026-01-19 17:21:42 +01:00
parent ef835e6f46
commit ab4d79a686
14 changed files with 58 additions and 14 deletions
+5 -1
View File
@@ -1067,9 +1067,13 @@ error:
coordinates for blending overlap: 坐标混合重叠
images used for blending must have the same size: 边框用图像必须使用相同大小
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
negative image height: Image with zero or negative height created in function '%s'
# error from files
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
no game specified: 没有为 %s 指定游戏类型
no stylesheet specified for the set: 没有为套牌制定样式表
stylesheet and set refer to different game:
+5 -1
View File
@@ -1065,9 +1065,13 @@ error:
coordinates for blending overlap: 坐標混合重疊
images used for blending must have the same size: 邊框用圖像必須使用相同大小
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
negative image height: Image with zero or negative height created in function '%s'
# error from files
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
no game specified: 沒有為 %s 指定游戲類型
no stylesheet specified for the set: 沒有為套牌制定樣式表
stylesheet and set refer to different game:
+4 -1
View File
@@ -1092,10 +1092,13 @@ error:
#TODO: Localize
images used for blending must have the same size: Images used for blending must have the same size
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
negative image height: Image with zero or negative height created in function '%s'
# error from files
#TODO: Localize Section
no card fields: Game '%s' does not have any card fields. Define at least one card field.
no game specified: No game specified for the %s
no stylesheet specified for the set: No stylesheet specified for the set
stylesheet and set refer to different game:
+3 -1
View File
@@ -1007,9 +1007,11 @@ error:
# image stuff
coordinates for blending overlap: Koordinaten zum Blenden überlappen sich
images used for blending must have the same size: Bilder müssen zum Mischen die selbe Größe haben.
no card fields: Das Spiel '%s' hat keine Kartenfelder. Definieren Sie mindestens ein Kartenfeld.
negative image width: Bild mit Breite Null oder negativer Breite, erstellt in der Funktion '%s'
negative image height: Bild mit Höhe Null oder negativer Höhe, erstellt in der Funktion '%s'
# error from files
no card fields: Das Spiel '%s' hat keine Kartenfelder. Definieren Sie mindestens ein Kartenfeld.
no game specified: Kein Spiel für %s gewählt
no stylesheet specified for the set: Kein Stylesheet für diese Edition gewählt
stylesheet and set refer to different game:
+2
View File
@@ -1009,6 +1009,8 @@ error:
# image stuff
coordinates for blending overlap: Coordinates for blending overlap
images used for blending must have the same size: Images used for blending must have the same size
negative image width: Image with zero or negative width created in function '%s'
negative image height: Image with zero or negative height created in function '%s'
# error from files
no card fields: Game '%s' does not have any card fields. Define at least one card field.
+5 -1
View File
@@ -1068,9 +1068,13 @@ error:
coordinates for blending overlap: Coordenadas para la mezcla (blending) solapada
images used for blending must have the same size: Las imagenes utilizadas para la mezcla (blending) deben tener el mismo tamaño
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
negative image height: Image with zero or negative height created in function '%s'
# error from files
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
no game specified: Ningún juego especificado para el %s
no stylesheet specified for the set: Ho hay hojas de estilo (stylesheet) especificadas para el Set
stylesheet and set refer to different game:
+3 -1
View File
@@ -1008,9 +1008,11 @@ error:
# image stuff
coordinates for blending overlap: Coordonnées pour la superposition du mélange
images used for blending must have the same size: Les images utilisées pour le mélange doivent avoir la même taille
no card fields: Le jeu '%s' ne contient aucun champ de carte. Définissez au moins un champ de carte.
negative image width: Image de largeur nulle ou négative créée par la fonction '%s'
negative image height: Image de hauteur nulle ou négative créée par la fonction '%s'
# error from files
no card fields: Le jeu '%s' ne contient aucun champ de carte. Définissez au moins un champ de carte.
no game specified: Pas de jeu spécifié pour le %s
no stylesheet specified for the set: Pas de Style spécifié pour le Set
stylesheet and set refer to different game:
+3 -1
View File
@@ -1008,9 +1008,11 @@ error:
# image stuff
coordinates for blending overlap: Coordinate per sovrapposizione
images used for blending must have the same size: Le immagini sovrapposte devono avere le stesse misure
no card fields: Il gioco '%s' non ha campi carta. Definisci almeno un campo carta.
negative image width: Immagine con larghezza zero o negativa creata nella funzione '%s'
negative image height: Immagine con altezza zero o negativa creata nella funzione '%s'
# error from files
no card fields: Il gioco '%s' non ha campi carta. Definisci almeno un campo carta.
no game specified: Nessun gioco specificato per il %s
no stylesheet specified for the set: Nessuno stile specificato per il set
stylesheet and set refer to different game:
+5 -1
View File
@@ -1068,9 +1068,13 @@ error:
coordinates for blending overlap: オーバーラップを混ぜることのための座標
images used for blending must have the same size: 混ざることのために使われたイメージは同じサイズを持たなければなりません
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
negative image height: Image with zero or negative height created in function '%s'
# error from files
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
no game specified: のゲームに指定された %s
no stylesheet specified for the set: セットのために指定されたスタイルシートはありません
stylesheet and set refer to different game:
+5 -1
View File
@@ -1074,9 +1074,13 @@ error:
coordinates for blending overlap: 블렌딩 오버랩을 위한 좌표
images used for blending must have the same size: 블렌딩에 사용되는 이미지의 크기는 동일해야 합니다.
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
negative image height: Image with zero or negative height created in function '%s'
# error from files
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
no game specified: 에 지정된 게임이 없습니다 %s
no stylesheet specified for the set: 세트에 지정된 스타일시트가 없습니다
stylesheet and set refer to different game:
+5 -1
View File
@@ -1124,9 +1124,13 @@ error:
coordinates for blending overlap: Współrzędne scalania (blending) nachodzą na siebie
images used for blending must have the same size: Obrazy użyte do scalania (blending) muszą mieć ten sam rozmiar
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
negative image height: Image with zero or negative height created in function '%s'
# error from files
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
no game specified: Nie podano gry dla %s
no stylesheet specified for the set: Nie podano arkusza stylu dla zestawu
stylesheet and set refer to different game:
+3 -1
View File
@@ -1009,9 +1009,11 @@ error:
# image stuff
coordinates for blending overlap: Cordenadas para mistura sobreposição
images used for blending must have the same size: Imagens utilizados para a mistura deve ter o mesmo tamanho
no card fields: O jogo '%s' não possui campos de Card. Defina pelo menos um campo de Card.
negative image width: Imagem com largura zero ou negativa criada na função '%s'
negative image height: Imagem com altura zero ou negativa criada na função '%s'
# error from files
no card fields: O jogo '%s' não possui campos de Card. Defina pelo menos um campo de Card.
no game specified: Não há jogo especificado para o %s
no stylesheet specified for the set: Não estilo especificado para a Edição
stylesheet and set refer to different game:
+4 -1
View File
@@ -1120,10 +1120,13 @@ error:
#TODO: Localize
images used for blending must have the same size: Images used for blending must have the same size
#TODO: Localize
no card fields: Game '%s' does not have any card fields. Define at least one card field.
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
negative image height: Image with zero or negative height created in function '%s'
# error from files
#TODO: Localize Section
no card fields: Game '%s' does not have any card fields. Define at least one card field.
no game specified: No game specified for the %s
no stylesheet specified for the set: No stylesheet specified for the set
stylesheet and set refer to different game:
+4
View File
@@ -461,6 +461,8 @@ Image InsertedImage::generate(const Options& opt) {
int inserted_y = offset_y < 0 ? 0 : offset_y;
int width = max(base_x + base_img.GetWidth(), inserted_x + inserted_img.GetWidth());
int height = max(base_y + base_img.GetHeight(), inserted_y + inserted_img.GetHeight());
if (width <= 0) throw ScriptError(_ERROR_1_("negative image width", "insert_image"));
if (height <= 0) throw ScriptError(_ERROR_1_("negative image height", "insert_image"));
UInt size = width * height;
Image img = wxImage(width, height, false);
img.InitAlpha();
@@ -497,6 +499,8 @@ bool InsertedImage::operator == (const GeneratedImage& that) const {
// ----------------------------------------------------------------------------- : CropImage
Image CropImage::generate(const Options& opt) {
if (width <= 0) throw ScriptError(_ERROR_1_("negative image width", "crop_image"));
if (height <= 0) throw ScriptError(_ERROR_1_("negative image height", "crop_image"));
UInt size = width * height;
Image img = wxImage(width, height, false);
img.InitAlpha();