Skip to content

Use correct input type for example UDR multi#9002

Open
Ev3nt wants to merge 1 commit intoFirebirdSQL:masterfrom
Ev3nt:udr_mult_fix
Open

Use correct input type for example UDR multi#9002
Ev3nt wants to merge 1 commit intoFirebirdSQL:masterfrom
Ev3nt:udr_mult_fix

Conversation

@Ev3nt
Copy link
Copy Markdown
Contributor

@Ev3nt Ev3nt commented Apr 22, 2026

Summary

Invalid types conversion.

Details

When calling ExampleBCD::load, we pass a pointer to the FB_DEC34 data type, but in fact the memory referenced by the pointer is an ordinary int. This causes the crash.

PoC

A simple script that causes an error:

import os
import subprocess
import sys
from pathlib import Path

ISQL = Path("/home/user/repositories/firebird-6/gen/Debug/firebird/bin/isql")

def build_sql() -> str:
  return f"""
      connect localhost:employee user 'SYSDBA' password 'masterkey';
      set term ^;
      create function mult(a integer, b integer)
      returns integer
      external name 'udrcpp_example!mult'
      engine udr^
      set term ;^
      commit;
      select mult(2.49, -8) from rdb$database;
      quit;
      """

def run_isql(sql: str) -> int:
  proc = subprocess.run(
    [str(ISQL), "-q"],
    input=sql.encode()
  )
  print("returncode:", proc.returncode)
  if proc.returncode < 0:
    print(f"terminated by signal: {-proc.returncode}")
  return proc.returncode

def main():
  run_isql(build_sql())

if __name__ == "__main__":
  main()

@AlexPeshkoff AlexPeshkoff self-assigned this Apr 22, 2026
@Ev3nt Ev3nt changed the title UDR!mult fix Use correct input type for example UDR multi Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants