gemini-code-assist[bot] commented on code in PR #171:
URL: https://github.com/apache/tvm-ffi/pull/171#discussion_r2442417020


##########
src/ffi/object.cc:
##########
@@ -431,6 +431,12 @@ class OpaqueObjectImpl : public Object, public 
TVMFFIOpaqueObjectCell {
 }  // namespace ffi
 }  // namespace tvm
 
+void TVMFFIGetVersion(TVMFFIVersion* out_version) {
+  out_version->major = TVM_FFI_VERSION_MAJOR;
+  out_version->minor = TVM_FFI_VERSION_MINOR;
+  out_version->patch = TVM_FFI_VERSION_PATCH;
+}

Review Comment:
   ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   The `TVMFFIGetVersion` function doesn't check if `out_version` is `nullptr`. 
If a `nullptr` is passed from the C API, this will cause a segmentation fault 
by dereferencing a null pointer. It's crucial for C API functions to be robust 
against such inputs. Please add a null check.
   
   ```suggestion
   void TVMFFIGetVersion(TVMFFIVersion* out_version) {
     if (out_version == nullptr) return;
     out_version->major = TVM_FFI_VERSION_MAJOR;
     out_version->minor = TVM_FFI_VERSION_MINOR;
     out_version->patch = TVM_FFI_VERSION_PATCH;
   }
   ```



##########
README.md:
##########
@@ -38,3 +38,18 @@ It has the following technical features:
 With these technical solutions, we can enable better **interoperability** 
across machine learning frameworks,
 libraries, kernel DSLs, and coding agents, **ship one wheel** to support 
multiple frameworks and Python versions (including free-threaded python),
 and build infrastructure solutions across environments.
+
+## Status and Release Versioning
+
+C ABI stability is the top priority of this effort. We also prioritize 
minimalism and
+efficiency in the core so it is portable and can be used broadly.
+We are current in the RFC stage, which means the main features are complete 
and ABI stable.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   There is a minor typo here. 'current' should be 'currently'.
   
   ```suggestion
   We are currently in the RFC stage, which means the main features are 
complete and ABI stable.
   ```



##########
README.md:
##########
@@ -38,3 +38,18 @@ It has the following technical features:
 With these technical solutions, we can enable better **interoperability** 
across machine learning frameworks,
 libraries, kernel DSLs, and coding agents, **ship one wheel** to support 
multiple frameworks and Python versions (including free-threaded python),
 and build infrastructure solutions across environments.
+
+## Status and Release Versioning
+
+C ABI stability is the top priority of this effort. We also prioritize 
minimalism and
+efficiency in the core so it is portable and can be used broadly.
+We are current in the RFC stage, which means the main features are complete 
and ABI stable.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   There is a minor typo here. 'current' should be 'currently'.
   
   ```suggestion
   We are currently in the RFC stage, which means the main features are 
complete and ABI stable.
   ```



##########
src/ffi/object.cc:
##########
@@ -431,6 +431,12 @@ class OpaqueObjectImpl : public Object, public 
TVMFFIOpaqueObjectCell {
 }  // namespace ffi
 }  // namespace tvm
 
+void TVMFFIGetVersion(TVMFFIVersion* out_version) {
+  out_version->major = TVM_FFI_VERSION_MAJOR;
+  out_version->minor = TVM_FFI_VERSION_MINOR;
+  out_version->patch = TVM_FFI_VERSION_PATCH;
+}

Review Comment:
   ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   The `TVMFFIGetVersion` function doesn't check if `out_version` is `nullptr`. 
If a `nullptr` is passed from the C API, this will cause a segmentation fault 
by dereferencing a null pointer. It's crucial for C API functions to be robust 
against such inputs. Please add a null check.
   
   ```suggestion
   void TVMFFIGetVersion(TVMFFIVersion* out_version) {
     if (out_version == nullptr) return;
     out_version->major = TVM_FFI_VERSION_MAJOR;
     out_version->minor = TVM_FFI_VERSION_MINOR;
     out_version->patch = TVM_FFI_VERSION_PATCH;
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to