Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repositories {
}

dependencies {
implementation("app.photofox.vips-ffm:vips-ffm-core:1.9.6")
implementation("app.photofox.vips-ffm:vips-ffm-core:1.9.7")
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins {
kotlin("jvm") version "2.3.0" apply false
kotlin("jvm") version "2.3.21" apply false
}
9 changes: 8 additions & 1 deletion core/src/main/java/app/photofox/vipsffm/VImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -10454,7 +10454,14 @@ public VBlob getBlob(String name) {
if (!VipsValidation.isValidPointer(outPointer)) {
throw new VipsError("failed to read value of type blob from field: " + name);
}
var blobAddress = outPointer.get(VipsRaw.C_POINTER, 0);
if (!VipsValidation.isValidPointer(outLengthPointer)) {
throw new VipsError("failed to read length pointer of type blob from field: " + name);
}
var blobLength = outLengthPointer.get(VipsRaw.C_LONG, 0);
if (blobLength <= 0) {
throw new VipsError("failed to read length of type blob from field: " + name);
}
var blobAddress = outPointer.get(VipsRaw.C_POINTER, 0).reinterpret(blobLength);
return new VBlob(arena, blobAddress);
}

Expand Down
17 changes: 16 additions & 1 deletion generator/src/main/kotlin/vipsffm/GenerateVClasses.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,22 @@ object GenerateVClasses {

vblobType -> {
// void **
this.addStatement("var blobAddress = outPointer.get(\$T.C_POINTER, 0)", vipsRawType)
this.addCode(
CodeBlock.builder()
.beginControlFlow("if (!\$T.isValidPointer(outLengthPointer))", vipsValidatorType)
.addStatement("throw new VipsError(\"failed to read length pointer of type $typeName from field: \" + name)")
.endControlFlow()
.build()
)
this.addStatement("var blobLength = outLengthPointer.get(\$T.C_LONG, 0)", vipsRawType)
this.addCode(
CodeBlock.builder()
.beginControlFlow("if (blobLength <= 0)")
.addStatement("throw new VipsError(\"failed to read length of type $typeName from field: \" + name)")
.endControlFlow()
.build()
)
this.addStatement("var blobAddress = outPointer.get(\$T.C_POINTER, 0).reinterpret(blobLength)", vipsRawType)
this.addStatement("return new VBlob(arena, blobAddress)")
}

Expand Down
Loading