Harvey Weinstein is serving a 23-year sentence on rape and sexual assault charges, which make him ineligible for parole until after his 87th birthday. He’s also facing additional charges in Los Angeles that carry a maximum sentence of 140 years.

But the disgraced producer could go free in just a few months if a New York appeals court overturns his conviction.

Five justices heard arguments on the case on Wednesday, and three of them expressed serious concern about the testimony admitted at trial. One justice, Sallie Manzanet-Daniels, referred to the use of uncharged allegations as “overkill” and “piling on.”

Weinstein’s attorneys are not making any predictions about how the court will rule, but they are feeling optimistic.

“I think it couldn’t have gone better,” said Donna Rotunno, the lead defense lawyer at Weinstein’s trial, who said that the line of questioning felt like “a wish list of how you want something like that to go.”

“We are very happy,” said her co-counsel, Damon Cheronis. “We are very hopeful, based on the appellate court’s questioning, that they see this case for what it is, that evidence that should have never been brought before this jury infected the trial and made it impossible for Mr. Weinstein to get a fair trial.”

The trial judge, Justice James Burke, allowed prosecutors to call three witnesses — Tarale Wulff, Dawn Dunning and Lauren Young — who testified that Weinstein had sexually assaulted them during what they thought were business meetings. Those allegations were not eligible to be charged, but they were used to support the allegations for which Weinstein was on trial.

Burke also ruled that if Weinstein took the stand, prosecutors could cross-examine him about as many as 28 other uncharged acts, including an incident when he threatened to cut off someone’s genitals, and another when he left an employee by the side of the road. Weinstein did not testify, so that evidence was not heard.

At the oral argument on Wednesday, the justices questioned whether those decisions — called Molineux and Sandoval rulings, respectively — served to impugn Weinstein’s character, rather than to shed light on whether he committed the charged offenses.

“He doesn’t get convicted because he’s a bad guy,” said Justice Judith Gische. “He gets convicted for these particular crimes.”

Assistant District Attorney Valerie Figueredo argued that Burke had balanced his rulings and excluded some of the evidence sought by the prosecution.

Julie Rendelman, a defense attorney and former Brooklyn prosecutor, said the D.A.’s office may have erred by asking for too much evidence, even if Burke was willing to allow most of it.

“My mother always said, ‘Don’t be a chazir‘ — a taker,” she said. “Their job is not to get in everything. Their job is to make sure everything is protected. You don’t want to be in the situation they’re in now. You don’t want your case potentially overturned.”

Several attorneys said Thursday that the justices’ questions don’t guarantee that they will order a new trial. It is possible that the justices could fault Burke’s rulings, but uphold the verdict on the grounds that the jury had overwhelming evidence without the extra testimony. It’s also possible that the justices could split, and those who raised the gravest concerns could end up in the minority.

“We’re kind of reading tea leaves here,” said defense attorney Michael Bachner. But, he added, “The New York State court is not bashful about overturning convictions, even in high profile cases.”

Bennett Gershman, a professor at Pace Law School, teaches about Molineux testimony, and suggested that its use in the Weinstein case was “dubious.”

“This proof is dangerous because it carries such tremendous prejudice,” Gershman said. “There are a number of cases the courts have reversed. This is an issue the courts monitor very carefully because they know how devastating this proof can be.”

Weinstein was convicted of third-degree rape of Jessica Mann and first-degree assault of Miriam Haley. He was acquitted of charges pertaining to Annabella Sciorra, who alleged he had raped her at her apartment in the early 1990s. If the appeals court ordered a new trial, prosecutors could call Haley and Mann to testify again, but not Sciorra.

Haley’s attorney, Gloria Allred, said Thursday that if Haley were asked to testify at a retrial, “She will consider it.”

A new district attorney, Alvin Bragg, will be sworn in on Jan. 1. If the conviction is thrown out, he would ultimately have to make the decision about whether to try Weinstein again.

Bragg cited the Weinstein case during his campaign, faulting incumbent Cyrus Vance for not charging Weinstein for the alleged sexual assault of model Ambra Battilana Gutierrez in 2015. Bragg also noted that as chief deputy in the attorney general’s office, he had overseen the state’s civil case against Weinstein and the Weinstein Co.

Defense attorney Jeff Greco predicted that Bragg would face significant pressure to try Weinstein again.

“There’s no way they’re going to punt,” Greco said. “It would be political suicide.”

A spokesman for Vance’s office declined to comment. Bragg’s spokesman said it would be improper for him to comment on a pending case before he has taken office.

Weinstein is currently housed at the Twin Towers Correctional Facility in Los Angeles, where he is awaiting his trial on 11 other rape and sexual assault charges. That trial is not expected to begin until next summer, at the earliest. If the New York conviction is overturned, Weinstein’s attorneys would likely seek to have him released on bail.

“He would absolutely be bail eligible,” Greco said. “There would be no legal basis to keep him in.”

Rotunno argued that Weinstein did not get due process at his trial, nearly two years ago, and was instead subjected to “emotional decisions.” She said hoped there has been a shift in the overall climate since then.

“That was my beef with this case all along,” she said. “There was this ‘convict at all costs’ mentality. I will continue to be bothered by that.”

Cheronis agreed.

“They tried to create this monster we never believed existed,” Cheronis said. “They were allowed to put in evidence that wasn’t relevant, that was prejudicial, and thank God people are now taking it seriously.”