prevent dangling pointer 0x8 for empty JSON maps/arrays
Rust Vec::with_capacity(0).as_mut_ptr() returns alignment pointer 0x8 instead of null. Go's stack scanner interprets 0x8 as a valid pointer and panics during goroutine stack growth. - Add len > 0 guard to youtput_read_json_map and youtput_read_json_array in yffi to return null for empty collections - Handle null entriesPtr with len==0 gracefully in Go convertToJSONMap and convertToJSONArray - Update y-crdt submodule to fix-empty-json-ptr branch - Rebuild libyrs.a with the fix add y-crdt submodule tracking fix-empty-json-ptr branch
3 files changed,  +7, -0
M .gitmodules
+1, -0
1@@ -1,3 +1,4 @@
2 [submodule "y-crdt"]
3 	path = y-crdt
4 	url = https://github.com/BTBurke/y-crdt
5+	branch = fix-empty-json-ptr
M lib/linux-amd64/libyrs.a
+0, -0
M output.go
+6, -0
 1@@ -351,6 +351,9 @@ func (o *Output) JSON(receiver interface{}) error {
 2 func (o *Output) convertToJSONMap() (map[string]interface{}, error) {
 3 	entriesPtr := C.youtput_read_json_map(o.ptr)
 4 	if entriesPtr == nil {
 5+		if int(o.ptr.len) == 0 {
 6+			return make(map[string]interface{}), nil
 7+		}
 8 		return nil, fmt.Errorf("failed to read json map")
 9 	}
10 
11@@ -374,6 +377,9 @@ func (o *Output) convertToJSONMap() (map[string]interface{}, error) {
12 func (o *Output) convertToJSONArray() ([]interface{}, error) {
13 	outputsPtr := C.youtput_read_json_array(o.ptr)
14 	if outputsPtr == nil {
15+		if int(o.ptr.len) == 0 {
16+			return []interface{}{}, nil
17+		}
18 		return nil, fmt.Errorf("failed to read json array")
19 	}
20