KEMBAR78
chore: update protobuf deps by simonresch · Pull Request #985 · CodeIntelligenceTesting/jazzer · GitHub
Skip to content

Conversation

@simonresch
Copy link
Contributor

@simonresch simonresch commented Oct 15, 2025

This PR updates protobuf dependencies to the latest stable version.

When updating to a protobuf version >= 26.0 one case in the mutator StressTest starts to fail (proto3 message with repeated uint32). This is a somewhat smaller reproducer for this error:

package com.code_intelligence.jazzer.mutation.mutator;

import com.code_intelligence.jazzer.mutation.annotation.NotNull;
import com.code_intelligence.jazzer.mutation.api.ExtendedMutatorFactory;
import com.code_intelligence.jazzer.mutation.api.PseudoRandom;
import com.code_intelligence.jazzer.mutation.api.SerializingMutator;
import com.code_intelligence.jazzer.mutation.support.TypeHolder;

import static com.code_intelligence.jazzer.protobuf.Proto3.RepeatedIntegralField3;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

import static com.code_intelligence.jazzer.mutation.support.TestSupport.anyPseudoRandom;

public class DebugProtoMutator {
  public static void main(String[] args) throws IOException {
    ExtendedMutatorFactory factory = Mutators.newFactory();
    SerializingMutator mutator =
        factory.createOrThrow(new TypeHolder<@NotNull RepeatedIntegralField3>() {}.annotatedType());
    PseudoRandom rng = anyPseudoRandom();
    RepeatedIntegralField3 value = RepeatedIntegralField3.getDefaultInstance();

    for (int mutation = 0; mutation < 10000; mutation++) {
      System.err.println(mutation);
      value = (RepeatedIntegralField3) mutator.mutate(value, rng);
      System.err.println(
          "value len: " + value.getSomeFieldCount() + " size " + value.getSerializedSize());
      value.toByteArray();
    }
  }
}

Which fails after a few successful mutations in the toByteArray() function:

Exception in thread "main" java.lang.IllegalStateException: Did not write as much data as expected.
	at com.google.protobuf.CodedOutputStream.checkNoSpaceLeft(CodedOutputStream.java:900)
	at com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:57)
	at com.code_intelligence.jazzer.mutation.mutator.DebugProtoMutator.main(DebugProtoMutator.java:34)

The root cause for this is as of yet not understood but it appears to be jdk dependent. The issue could not be observed with remotejdk_8 or remotejdk_11. Using a JDK 21 the issue appears for patch versions <= 7. Updating from 21.0.6 (from rules_java) to 21.0.8 resolves this issue.

@simonresch simonresch force-pushed the update-protobuf-deps branch 3 times, most recently from 11b2a14 to 8069a9a Compare October 15, 2025 11:27
@simonresch simonresch marked this pull request as ready for review October 15, 2025 12:51
@simonresch simonresch requested a review from a team October 15, 2025 12:51
... from the rules_java provided JDK 21.0.6.
This seems to be a pre-requesite for upgrading protobuf to > 26.0.
Recent versions of googletest require C++17 to compile.
@simonresch simonresch force-pushed the update-protobuf-deps branch from 8069a9a to 89f0536 Compare October 16, 2025 06:36
@simonresch simonresch changed the title update protobuf deps chore: update protobuf deps Oct 16, 2025
Copy link
Contributor

@oetr oetr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@simonresch simonresch merged commit 86378b7 into main Oct 16, 2025
16 of 19 checks passed
@simonresch simonresch deleted the update-protobuf-deps branch October 16, 2025 08:18
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.

3 participants